Make it explicit we're mirroring the Pulse connection for tests

This commit is contained in:
George Hickman 2018-08-17 11:57:32 +01:00 коммит произвёл George Hickman
Родитель e451c2821e
Коммит 3e92d05eef
3 изменённых файлов: 14 добавлений и 9 удалений

Просмотреть файл

@ -340,10 +340,19 @@ def activate_responses(request):
request.addfinalizer(fin)
def pulse_consumer(exchange, request):
exchange_name = 'exchange/treeherder/v1/{}'.format(exchange)
@pytest.fixture
def pulse_connection():
"""
Build a Pulse connection with the Kombu library
connection = kombu.Connection(settings.PULSE_URL)
This is a non-lazy mirror of our Pulse service's build_connection as
explained in: https://bugzilla.mozilla.org/show_bug.cgi?id=1484196
"""
return kombu.Connection(settings.BROKER_URL)
def pulse_consumer(connection, exchange, request):
exchange_name = 'exchange/treeherder/v1/{}'.format(exchange)
exchange = kombu.Exchange(
name=exchange_name,
@ -370,8 +379,8 @@ def pulse_consumer(exchange, request):
@pytest.fixture
def pulse_action_consumer(request):
return pulse_consumer('job-actions', request)
def pulse_action_consumer(pulse_connection, request):
return pulse_consumer(pulse_connection, 'job-actions', request)
@pytest.fixture

Просмотреть файл

@ -11,7 +11,6 @@ CELERY_EAGER_PROPAGATES_EXCEPTIONS = True
# Reconfigure pulse to operate on default vhost of rabbitmq
PULSE_URI = BROKER_URL
PULSE_URL = BROKER_URL
# Set a fake api key for testing bug filing
BUGFILER_API_KEY = "12345helloworld"

Просмотреть файл

@ -506,6 +506,3 @@ PERFHERDER_ALERTS_MAX_AGE = timedelta(weeks=2)
# More details here: https://bugzilla.mozilla.org/show_bug.cgi?id=1281821
# TODO: remove this in favour of settings.PULSE_URL
PULSE_URI = env("PULSE_URI", default="amqps://guest:guest@pulse.mozilla.org/")
# The pulse url that is passed to kombu
PULSE_URL = env("PULSE_URL", default="amqps://guest:guest@pulse.mozilla.org/")