Skip to content

Commit 541a83d

Browse files
committed
.
1 parent fc610e3 commit 541a83d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/test_api.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,14 @@ def test_baggage_with_tracing_disabled(sentry_init):
9494
@pytest.mark.forked
9595
def test_baggage_with_tracing_enabled(sentry_init):
9696
sentry_init(traces_sample_rate=1.0, release="1.0.0", environment="dev")
97-
with start_span(name="foo") as span:
98-
expected_baggage_re = r"^sentry-transaction=foo,sentry-trace_id={},sentry-sample_rand=0\.\d{{6}},sentry-environment=dev,sentry-release=1\.0\.0,sentry-sample_rate=1\.0,sentry-sampled={}$".format(
99-
span.trace_id, "true" if span.sampled else "false"
100-
)
101-
assert re.match(expected_baggage_re, get_baggage())
97+
with mock.patch("sentry_sdk.tracing_utils.Random.uniform", return_value=0.123456):
98+
with start_span(name="foo") as span:
99+
expected_baggage = SortedBaggage(
100+
"sentry-transaction=foo,sentry-trace_id={},sentry-sample_rand=0.123456,sentry-environment=dev,sentry-release=1.0.0,sentry-sample_rate=1.0,sentry-sampled={}".format(
101+
span.trace_id, "true" if span.sampled else "false"
102+
)
103+
)
104+
assert expected_baggage == get_baggage()
102105

103106

104107
@pytest.mark.forked

0 commit comments

Comments
 (0)