diff --git a/tests/test_api.py b/tests/test_api.py index acc33cdf4c..bd6b245841 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -22,6 +22,7 @@ ) from sentry_sdk.client import Client, NonRecordingClient +from tests.conftest import TestTransportWithOptions def test_get_current_span(): @@ -96,6 +97,21 @@ def test_baggage_with_tracing_enabled(sentry_init): assert re.match(expected_baggage_re, get_baggage()) +def test_baggage_with_dsn(sentry_init): + 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, + ) + with start_transaction() as transaction: + 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( + transaction.trace_id, "true" if transaction.sampled else "false" + ) + assert re.match(expected_baggage_re, get_baggage()) + + def test_continue_trace(sentry_init): sentry_init()