Skip to content

Commit

Permalink
test(celery): Add test for "custom" queue set on span
Browse files Browse the repository at this point in the history
The previous test only checked that the queue was set on the span when the queue had the default name ("celery"). This test adds a check to ensure the queue also gets set on the span when it has a non-default value.
  • Loading branch information
szokeasaurusrex committed Apr 26, 2024
1 parent fc2fa2a commit 0c5340a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/integrations/celery/test_celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,11 +618,14 @@ def example_task():
assert result.get() == "success"


@pytest.mark.parametrize("routing_key", ("celery", "custom"))
@mock.patch("celery.app.task.Task.request")
def test_messaging_destination_name(mock_request, init_celery, capture_events):
def test_messaging_destination_name(
mock_request, routing_key, init_celery, capture_events
):
celery_app = init_celery(enable_tracing=True)
events = capture_events()
mock_request.delivery_info = {"routing_key": "celery", "exchange": ""}
mock_request.delivery_info = {"routing_key": routing_key, "exchange": ""}

@celery_app.task()
def task(): ...
Expand All @@ -631,4 +634,4 @@ def task(): ...

(event,) = events
(span,) = event["spans"]
assert span["data"]["messaging.destination.name"] == "celery"
assert span["data"]["messaging.destination.name"] == routing_key

0 comments on commit 0c5340a

Please sign in to comment.