def test_get_hosts_forgotten_down( mock_get_hosts_past_maintenance_end, mock_get_down_hosts, ): mock_get_down_hosts.return_value = ['fake-host1', 'fake-host2'] mock_get_hosts_past_maintenance_end.return_value = ['fake-host2'] assert get_hosts_forgotten_down() == ['fake-host2']
def test_get_hosts_forgotten_down( mock_get_hosts_past_maintenance_end, mock_get_down_hosts, ): mock_get_down_hosts.return_value = ['fake-host1', 'fake-host2'] mock_get_hosts_past_maintenance_end.return_value = ['fake-host2'] assert get_hosts_forgotten_down() == ['fake-host2']
def cleanup_forgotten_down(): """Clean up hosts forgotten down""" log.debug("Cleaning up hosts forgotten down") hosts_forgotten_down = get_hosts_forgotten_down(grace=seconds_to_nanoseconds(10 * 60)) if hosts_forgotten_down: up(hostnames=hosts_forgotten_down) else: log.debug("No hosts forgotten down")
def test_get_hosts_forgotten_down(mock_get_hosts_past_maintenance_end, mock_get_down_hosts): mock_get_down_hosts.return_value = ["fake-host1", "fake-host2"] mock_get_hosts_past_maintenance_end.return_value = ["fake-host2"] assert get_hosts_forgotten_down() == ["fake-host2"]