Skip to content

Commit efed788

Browse files
committed
test(spring-boot): Move the Boot 2 OTel agent sample's tests into the module
Adds the agent setup to sentry-spring-boot, as in the Boot 3 and 4 modules. The sample's tests were the Boot 3 agent sample's minus Cache and RestClient, which Boot 2 doesn't have. GraphQL and Kafka are gated on Boot 2.7, as in the other Boot 2 suites. The shared app has to start on Boot versions without Kafka support, so the Kafka test starts an app of its own with the kafka profile and an in-JVM broker. AgentApp becomes a class for that, with the shared instance in its companion. The sample has no system tests left, so it comes off the system-test runner, the backend workflow and the Spring Boot 2 matrix, which now runs both agent tasks and no longer builds the agent separately. integrationTests includes them too. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 65720b4 commit efed788

33 files changed

Lines changed: 1141 additions & 753 deletions

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

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -75,32 +75,17 @@ jobs:
7575
- name: Build sample artifacts
7676
run: |
7777
./gradlew \
78-
:sentry-samples:sentry-samples-spring-boot-opentelemetry:shadowJar \
79-
:sentry-samples:sentry-samples-spring-boot-opentelemetry:testClasses \
8078
:sentry-samples:sentry-samples-spring:war \
81-
:sentry-samples:sentry-samples-spring:testClasses \
82-
:sentry-opentelemetry:sentry-opentelemetry-agent:assemble
79+
:sentry-samples:sentry-samples-spring:testClasses
8380
8481
- name: Test sentry-spring-boot integration suites
8582
run: |
8683
./gradlew \
8784
:sentry-spring-boot:integrationTest \
8885
:sentry-spring-boot:integrationTestWebflux \
89-
:sentry-spring-boot:integrationTestOtelNoAgent
90-
91-
- name: Test sentry-samples-spring-boot-opentelemetry agent init true
92-
run: |
93-
python3 test/system-test-runner.py test \
94-
--module "sentry-samples-spring-boot-opentelemetry" \
95-
--agent true \
96-
--auto-init "true"
97-
98-
- name: Test sentry-samples-spring-boot-opentelemetry agent init false
99-
run: |
100-
python3 test/system-test-runner.py test \
101-
--module "sentry-samples-spring-boot-opentelemetry" \
102-
--agent true \
103-
--auto-init "false"
86+
:sentry-spring-boot:integrationTestOtelNoAgent \
87+
:sentry-spring-boot:integrationTestOtelAgent \
88+
:sentry-spring-boot:integrationTestOtelAgentWithoutAutoInit
10489
10590
- name: Test sentry-samples-spring
10691
run: |

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ jobs:
2828
agent: [ "false" ]
2929
agent-auto-init: [ "true" ]
3030
include:
31-
- sample: "sentry-samples-spring-boot-opentelemetry"
32-
agent: "true"
33-
agent-auto-init: "true"
34-
- sample: "sentry-samples-spring-boot-opentelemetry"
35-
agent: "true"
36-
agent-auto-init: "false"
3731
- sample: "sentry-samples-console-otlp"
3832
agent: "false"
3933
agent-auto-init: "true"

‎build.gradle.kts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ tasks.register("integrationTests") {
226226
":sentry-spring-boot:integrationTest",
227227
":sentry-spring-boot:integrationTestWebflux",
228228
":sentry-spring-boot:integrationTestOtelNoAgent",
229+
":sentry-spring-boot:integrationTestOtelAgent",
230+
":sentry-spring-boot:integrationTestOtelAgentWithoutAutoInit",
229231
":sentry-spring-boot-jakarta:integrationTest",
230232
":sentry-spring-boot-jakarta:integrationTestWebflux",
231233
":sentry-spring-boot-jakarta:integrationTestOtelNoAgent",

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

Lines changed: 0 additions & 43 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
@@ -78,18 +77,6 @@ dependencies {
7877
// database query tracing
7978
implementation(projects.sentryJdbc)
8079
runtimeOnly(libs.hsqldb)
81-
82-
testImplementation(kotlin(Config.kotlinStdLib))
83-
testImplementation(projects.sentrySystemTestSupport)
84-
testImplementation(libs.apollo3.kotlin)
85-
testImplementation(libs.kotlin.test.junit)
86-
testImplementation(libs.slf4j2.api)
87-
testImplementation(libs.springboot.starter.test) {
88-
exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
89-
}
90-
testImplementation("ch.qos.logback:logback-classic:1.5.16")
91-
testImplementation("ch.qos.logback:logback-core:1.5.16")
92-
testImplementation("org.apache.httpcomponents:httpclient")
9380
}
9481

9582
val runtimeClasspath = configurations.named("runtimeClasspath")
@@ -150,33 +137,3 @@ tasks.register<JavaExec>("bootRunWithAgent").configure {
150137

151138
jvmArgs = listOf("-Dotel.javaagent.debug=true", "-javaagent:$agentJarPath")
152139
}
153-
154-
// The runner launches this sample with -javaagent, so track the agent jar as a systemTest input.
155-
sentrySystemTest { usesOpenTelemetryAgent = true }
156-
157-
tasks.register<Test>("systemTest").configure {
158-
group = "verification"
159-
description = "Runs the System tests"
160-
161-
val test = project.extensions.getByType<SourceSetContainer>()["test"]
162-
testClassesDirs = test.output.classesDirs
163-
classpath = test.runtimeClasspath
164-
165-
maxParallelForks = 1
166-
167-
filter {
168-
includeTestsMatching("io.sentry.systemtest*")
169-
if (!includeGraphql) {
170-
excludeTestsMatching("io.sentry.systemtest.Graphql*")
171-
}
172-
if (!includeKafka) {
173-
excludeTestsMatching("io.sentry.systemtest.Kafka*")
174-
}
175-
}
176-
}
177-
178-
tasks.named("test").configure {
179-
require(this is Test)
180-
181-
filter { excludeTestsMatching("io.sentry.systemtest.*") }
182-
}

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

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

‎sentry-samples/sentry-samples-spring-boot-opentelemetry/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/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt‎

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

0 commit comments

Comments
 (0)