Skip to content

Commit 07bdb82

Browse files
committed
Update Celery tests
1 parent fc8fa9f commit 07bdb82

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

tests/integrations/celery/test_celery.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,14 @@ def dummy_task(x, y):
228228
)
229229
assert submission_event["spans"] == [
230230
{
231-
"data": ApproxDict(),
231+
"data": {
232+
"sentry.name": "dummy_task",
233+
"sentry.op": "queue.submit.celery",
234+
"sentry.origin": "auto.queue.celery",
235+
"sentry.source": "custom",
236+
"thread.id": mock.ANY,
237+
"thread.name": mock.ANY,
238+
},
232239
"description": "dummy_task",
233240
"op": "queue.submit.celery",
234241
"origin": "auto.queue.celery",
@@ -238,9 +245,6 @@ def dummy_task(x, y):
238245
"timestamp": submission_event["spans"][0]["timestamp"],
239246
"trace_id": str(root_span.trace_id),
240247
"status": "ok",
241-
"tags": {
242-
"status": "ok",
243-
},
244248
}
245249
]
246250

tests/integrations/celery/test_update_celery_task_headers.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from sentry_sdk.integrations.celery import _update_celery_task_headers
88
import sentry_sdk
99
from sentry_sdk.tracing_utils import Baggage
10+
from tests.conftest import SortedBaggage
1011

1112

1213
BAGGAGE_VALUE = (
@@ -83,10 +84,11 @@ def test_span_with_transaction(sentry_init):
8384

8485
assert outgoing_headers["sentry-trace"] == span.to_traceparent()
8586
assert outgoing_headers["headers"]["sentry-trace"] == span.to_traceparent()
86-
assert outgoing_headers["baggage"] == transaction.get_baggage().serialize()
87-
assert (
88-
outgoing_headers["headers"]["baggage"]
89-
== transaction.get_baggage().serialize()
87+
assert outgoing_headers["baggage"] == SortedBaggage(
88+
transaction.get_baggage().serialize()
89+
)
90+
assert outgoing_headers["headers"]["baggage"] == SortedBaggage(
91+
transaction.get_baggage().serialize()
9092
)
9193

9294

@@ -117,11 +119,11 @@ def test_span_with_transaction_custom_headers(sentry_init):
117119
if x is not None and x != ""
118120
]
119121
)
120-
assert outgoing_headers["baggage"] == combined_baggage.serialize(
121-
include_third_party=True
122+
assert outgoing_headers["baggage"] == SortedBaggage(
123+
combined_baggage.serialize(include_third_party=True)
122124
)
123-
assert outgoing_headers["headers"]["baggage"] == combined_baggage.serialize(
124-
include_third_party=True
125+
assert outgoing_headers["headers"]["baggage"] == SortedBaggage(
126+
combined_baggage.serialize(include_third_party=True)
125127
)
126128

127129

0 commit comments

Comments
 (0)