Skip to content

Commit c204b78

Browse files
Lms24sl0thentr0py
authored andcommitted
test: Add test for get_baggage with DSN
1 parent 1476ff0 commit c204b78

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/test_api.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
)
2323

2424
from sentry_sdk.client import Client, NonRecordingClient
25+
from tests.conftest import TestTransportWithOptions
2526

2627

2728
def test_get_current_span():
@@ -96,6 +97,15 @@ def test_baggage_with_tracing_enabled(sentry_init):
9697
assert re.match(expected_baggage_re, get_baggage())
9798

9899

100+
def test_baggage_with_dsn(sentry_init):
101+
sentry_init(dsn="http://97333d956c9e40989a0139756c121c34@sentry-x.sentry-y.s.c.local/976543210", traces_sample_rate=1.0, release="2.0.0", environment="dev", transport=TestTransportWithOptions)
102+
with start_transaction() as transaction:
103+
expected_baggage_re = r"^sentry-trace_id={},sentry-sample_rand=0\.\d{{6}},sentry-environment=dev,sentry-release=2\.0\.0,sentry-public_key=97333d956c9e40989a0139756c121c34,sentry-sample_rate=1\.0,sentry-sampled={}$".format(
104+
transaction.trace_id, "true" if transaction.sampled else "false"
105+
)
106+
print('xx received baggage', get_baggage() )
107+
assert re.match(expected_baggage_re, get_baggage())
108+
99109
def test_continue_trace(sentry_init):
100110
sentry_init()
101111

0 commit comments

Comments
 (0)