Skip to content

Commit 435d2e7

Browse files
adinauerclaude
andcommitted
fix(test): Clean up global Sentry state in SentryPropagatorTest
SentryPropagatorTest calls Sentry.init with strict trace continuation but never closes Sentry afterward. This leaks global state into SentrySpanProcessorTest where SentryPropagator uses the global ScopesAdapter and rejects incoming sentry-trace headers under the leaked strict mode configuration. Add @AfterTest that calls Sentry.close() to prevent state leakage. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent cf7d9fe commit 435d2e7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SentryPropagatorTest.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import io.opentelemetry.context.Context
55
import io.sentry.Sentry
66
import io.sentry.opentelemetry.SentryOtelKeys.SENTRY_BAGGAGE_KEY
77
import io.sentry.opentelemetry.SentryOtelKeys.SENTRY_TRACE_KEY
8+
import kotlin.test.AfterTest
89
import kotlin.test.BeforeTest
910
import kotlin.test.Test
1011
import kotlin.test.assertFalse
@@ -17,6 +18,11 @@ class SentryPropagatorTest {
1718
Sentry.init("https://key@sentry.io/proj")
1819
}
1920

21+
@AfterTest
22+
fun teardown() {
23+
Sentry.close()
24+
}
25+
2026
@Suppress("DEPRECATION")
2127
@Test
2228
fun `ignores incoming headers when strict continuation rejects org id`() {

0 commit comments

Comments
 (0)