Skip to content

Commit 45cc1bf

Browse files
committed
test(spring-boot): Move the Boot 2 OTel no-agent sample's tests into the module
Adds an integrationTestOtelNoAgent suite to sentry-spring-boot, the Boot 2 counterpart of the Boot 3 one. The sample's tests were the Boot 3 sample's minus Cache and RestClient, which Boot 2 doesn't have. GraphQL and Kafka are gated on Boot 2.7, as in the servlet suite, and Kafka gets a context of its own. Sentry is global, so a second live context re-initializes it with that context's OpenTelemetry SDK, and the Sentry API spans of the first context's tests went to the wrong one. Each test class therefore starts its own context and closes it afterwards. The sample has no system tests left, so it comes off the system-test runner and the Spring Boot 2 matrix, which now runs the new suite, and the backend workflow's base row moves to the console sample. integrationTests includes the suite too. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 15a03c3 commit 45cc1bf

29 files changed

Lines changed: 975 additions & 751 deletions

‎.github/workflows/spring-boot-2-matrix.yml‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,16 @@ jobs:
7777
./gradlew \
7878
:sentry-samples:sentry-samples-spring-boot-opentelemetry:shadowJar \
7979
:sentry-samples:sentry-samples-spring-boot-opentelemetry:testClasses \
80-
:sentry-samples:sentry-samples-spring-boot-opentelemetry-noagent:shadowJar \
81-
:sentry-samples:sentry-samples-spring-boot-opentelemetry-noagent:testClasses \
8280
:sentry-samples:sentry-samples-spring:war \
8381
:sentry-samples:sentry-samples-spring:testClasses \
8482
:sentry-opentelemetry:sentry-opentelemetry-agent:assemble
8583
8684
- name: Test sentry-spring-boot integration suites
87-
run: ./gradlew :sentry-spring-boot:integrationTest :sentry-spring-boot:integrationTestWebflux
85+
run: |
86+
./gradlew \
87+
:sentry-spring-boot:integrationTest \
88+
:sentry-spring-boot:integrationTestWebflux \
89+
:sentry-spring-boot:integrationTestOtelNoAgent
8890
8991
- name: Test sentry-samples-spring-boot-opentelemetry agent init true
9092
run: |
@@ -100,13 +102,6 @@ jobs:
100102
--agent true \
101103
--auto-init "false"
102104
103-
- name: Test sentry-samples-spring-boot-opentelemetry-noagent
104-
run: |
105-
python3 test/system-test-runner.py test \
106-
--module "sentry-samples-spring-boot-opentelemetry-noagent" \
107-
--agent false \
108-
--auto-init "true"
109-
110105
- name: Test sentry-samples-spring
111106
run: |
112107
python3 test/system-test-runner.py test \

‎.github/workflows/system-tests-backend.yml‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
sample: [ "sentry-samples-spring-boot-opentelemetry-noagent" ]
27+
sample: [ "sentry-samples-console" ]
2828
agent: [ "false" ]
2929
agent-auto-init: [ "true" ]
3030
include:
@@ -40,9 +40,6 @@ jobs:
4040
- sample: "sentry-samples-spring-boot-jakarta-opentelemetry"
4141
agent: "true"
4242
agent-auto-init: "false"
43-
- sample: "sentry-samples-console"
44-
agent: "false"
45-
agent-auto-init: "true"
4643
- sample: "sentry-samples-console-otlp"
4744
agent: "false"
4845
agent-auto-init: "true"

‎build.gradle.kts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ tasks.register("integrationTests") {
225225
dependsOn(
226226
":sentry-spring-boot:integrationTest",
227227
":sentry-spring-boot:integrationTestWebflux",
228+
":sentry-spring-boot:integrationTestOtelNoAgent",
228229
":sentry-spring-boot-jakarta:integrationTest",
229230
":sentry-spring-boot-jakarta:integrationTestWebflux",
230231
":sentry-spring-boot-jakarta:integrationTestOtelNoAgent",

‎sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts‎

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ plugins {
77
alias(libs.plugins.shadow)
88
alias(libs.plugins.kotlin.jvm)
99
alias(libs.plugins.kotlin.spring)
10-
id("io.sentry.systemtest")
1110
}
1211

1312
// Spring scans this app's own bytecode with its repackaged ASM at startup, and the oldest version
@@ -79,18 +78,6 @@ dependencies {
7978
// database query tracing
8079
implementation(projects.sentryJdbc)
8180
runtimeOnly(libs.hsqldb)
82-
83-
testImplementation(kotlin(Config.kotlinStdLib))
84-
testImplementation(projects.sentrySystemTestSupport)
85-
testImplementation(libs.apollo3.kotlin)
86-
testImplementation(libs.kotlin.test.junit)
87-
testImplementation(libs.slf4j2.api)
88-
testImplementation(libs.springboot.starter.test) {
89-
exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
90-
}
91-
testImplementation("ch.qos.logback:logback-classic:1.5.16")
92-
testImplementation("ch.qos.logback:logback-core:1.5.16")
93-
testImplementation("org.apache.httpcomponents:httpclient")
9481
}
9582

9683
val runtimeClasspath = configurations.named("runtimeClasspath")
@@ -127,30 +114,3 @@ configure<SourceSetContainer> {
127114
}
128115
}
129116
}
130-
131-
tasks.register<Test>("systemTest").configure {
132-
group = "verification"
133-
description = "Runs the System tests"
134-
135-
val test = project.extensions.getByType<SourceSetContainer>()["test"]
136-
testClassesDirs = test.output.classesDirs
137-
classpath = test.runtimeClasspath
138-
139-
maxParallelForks = 1
140-
141-
filter {
142-
includeTestsMatching("io.sentry.systemtest*")
143-
if (!includeGraphql) {
144-
excludeTestsMatching("io.sentry.systemtest.Graphql*")
145-
}
146-
if (!includeKafka) {
147-
excludeTestsMatching("io.sentry.systemtest.Kafka*")
148-
}
149-
}
150-
}
151-
152-
tasks.named("test").configure {
153-
require(this is Test)
154-
155-
filter { excludeTestsMatching("io.sentry.systemtest.*") }
156-
}

‎sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/DummyTest.kt‎

Lines changed: 0 additions & 12 deletions
This file was deleted.

‎sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/DistributedTracingSystemTest.kt‎

Lines changed: 0 additions & 197 deletions
This file was deleted.

‎sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt‎

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)