File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
sentry/src/test/java/io/sentry Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,31 @@ class SentryTracerTest {
207207 )
208208 }
209209
210+ @Test
211+ fun `when transaction is finished, context is set` () {
212+ val tracer = fixture.getSut()
213+ val otelContext = mapOf (
214+ " attributes" to mapOf (
215+ " db.connection_string" to " hsqldb:mem:" ,
216+ " db.statement" to " CREATE TABLE person ( id INTEGER IDENTITY PRIMARY KEY, firstName VARCHAR(?) NOT NULL, lastName VARCHAR(?) NOT NULL )"
217+ ),
218+ " resource" to mapOf (
219+ " process.runtime.version" to " 17.0.4.1+1" ,
220+ " telemetry.auto.version" to " sentry-6.7.0-otel-1.19.2"
221+ )
222+ )
223+ tracer.setContext(" otel" , otelContext)
224+ tracer.finish()
225+
226+ verify(fixture.hub).captureTransaction(
227+ check {
228+ assertEquals(otelContext, it.contexts[" otel" ])
229+ },
230+ anyOrNull<TraceContext >(),
231+ anyOrNull()
232+ )
233+ }
234+
210235 @Test
211236 fun `returns sentry-trace header` () {
212237 val tracer = fixture.getSut()
You can’t perform that action at this time.
0 commit comments