Skip to content

Commit a574637

Browse files
committed
adapt test to modifications from original console sample
1 parent 0504c3c commit a574637

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

sentry-samples/sentry-samples-console-otlp/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.sentry.systemtest
22

3-
import io.sentry.protocol.SentryId
43
import io.sentry.systemtest.util.TestHelper
54
import java.util.concurrent.TimeUnit
65
import org.junit.Assert.assertEquals
@@ -25,11 +24,8 @@ class ConsoleApplicationSystemTest {
2524
jarFile,
2625
mapOf(
2726
"SENTRY_DSN" to testHelper.dsn,
28-
"SENTRY_TRACES_SAMPLE_RATE" to "1.0",
2927
"SENTRY_ENABLE_PRETTY_SERIALIZATION_OUTPUT" to "false",
3028
"SENTRY_DEBUG" to "true",
31-
"SENTRY_PROFILE_SESSION_SAMPLE_RATE" to "1.0",
32-
"SENTRY_PROFILE_LIFECYCLE" to "TRACE",
3329
),
3430
)
3531

@@ -41,7 +37,6 @@ class ConsoleApplicationSystemTest {
4137
}
4238

4339
private fun verifyExpectedEvents() {
44-
var profilerId: SentryId? = null
4540
// Verify we received a "Fatal message!" event
4641
testHelper.ensureErrorReceived { event ->
4742
event.message?.formatted == "Fatal message!" && event.level?.name == "FATAL"
@@ -65,17 +60,6 @@ class ConsoleApplicationSystemTest {
6560
event.level?.name == "DEBUG"
6661
}
6762

68-
// Verify we received transaction events
69-
testHelper.ensureTransactionReceived { transaction, _ ->
70-
profilerId = transaction.contexts.profile?.profilerId
71-
transaction.transaction == "transaction name" &&
72-
transaction.spans?.any { span -> span.op == "child" } == true
73-
}
74-
75-
testHelper.ensureProfileChunkReceived { profileChunk, envelopeHeader ->
76-
profileChunk.profilerId == profilerId
77-
}
78-
7963
// Verify we received the loop messages (should be 10 of them)
8064
var loopMessageCount = 0
8165
try {
@@ -96,6 +80,11 @@ class ConsoleApplicationSystemTest {
9680
loopMessageCount >= 5,
9781
)
9882

83+
// Verify we received the message captured within the OTel span
84+
testHelper.ensureErrorReceived { event ->
85+
event.message?.formatted == "this message is connected to the outerSpan"
86+
}
87+
9988
// Verify we have breadcrumbs
10089
testHelper.ensureErrorReceived { event ->
10190
event.breadcrumbs?.any { breadcrumb ->
@@ -106,7 +95,13 @@ class ConsoleApplicationSystemTest {
10695
testHelper.ensureMetricsReceived { metricsEvents, sentryEnvelopeHeader ->
10796
testHelper.doesContainMetric(metricsEvents, "countMetric", "counter", 1.0) &&
10897
testHelper.doesContainMetric(metricsEvents, "gaugeMetric", "gauge", 5.0) &&
109-
testHelper.doesContainMetric(metricsEvents, "distributionMetric", "distribution", 7.0)
98+
testHelper.doesContainMetric(metricsEvents, "distributionMetric", "distribution", 7.0) &&
99+
testHelper.doesContainMetric(metricsEvents, "invocations", "counter", 1.0)
100+
}
101+
102+
// Verify we received the log message captured within the OTel span
103+
testHelper.ensureLogsReceived { logs, _ ->
104+
testHelper.doesContainLogWithBody(logs, "Some error log message")
110105
}
111106
}
112107
}

0 commit comments

Comments
 (0)