Skip to content

Commit 663e7d5

Browse files
runningcodeclaude
andauthored
test(spring-boot): [Sample Tests 22] Move the Boot 2 OTel no-agent sample's tests (#6314)
* 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. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(spring-boot): Port the tracing and GraphQL checks to Boot 2 no-agent and restore Metrics Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(spring-boot): [Sample Tests 23] Port the Boot 3 OTel agent sample's Person, tracing and Todo tests (#6315) * test(spring-boot): Port the Boot 3 OTel agent sample's Person, tracing and Todo tests The agent tests now start the fixture app once per test JVM and share it, because it takes seconds to start. Which mode initializes Sentry is a property of the test task, so the suite's task runs with the agent initializing it and a new integrationTestOtelAgentWithoutAutoInit task runs the same tests with the Spring Boot starter doing it. Gradle runs the two in parallel. The fixture gains the Person POST, distributed tracing and Todo endpoints, and the suite ports the agent sample's Person, DistributedTracing and Todo tests. Sentry exports the agent's spans in batches every 5 seconds, which can't be configured, so each test waits for the next batch and the negative tracing check waits past one. ChildJvmApp now copies the app's output into the test's as it arrives instead of printing it on close. The shared app is closed when the JVM exits, where its whole log would otherwise land on the console. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test: Port the audit fixes to the Boot 3 agent Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(spring-boot): [Sample Tests 24] Port the rest of the Boot 3 OTel agent sample's tests (#6316) * test(spring-boot): Port the rest of the Boot 3 OTel agent sample's tests The agent fixture gains the Cache, Metrics, GraphQL and Kafka endpoints, and the agent suite ports the sample's remaining tests in both init modes. The agent traces each GraphQL operation as one span named after it, so the queries are named. Kafka uses an in-JVM KRaft broker that the test JVM starts next to the app. The sample has no system tests left, so it comes off the system-test runner, the backend workflow and the Spring Boot 3 matrix. The matrix no longer builds the agent separately, because the suites build the jar they attach. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(spring-boot): Check the Boot 3 agent GraphQL task query's assignee and creator ids Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 23eb8cf commit 663e7d5

65 files changed

Lines changed: 2207 additions & 1702 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.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/spring-boot-3-matrix.yml‎

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,8 @@ jobs:
7171
- name: Build sample artifacts
7272
run: |
7373
./gradlew \
74-
:sentry-samples:sentry-samples-spring-boot-jakarta-opentelemetry:bootJar \
75-
:sentry-samples:sentry-samples-spring-boot-jakarta-opentelemetry:testClasses \
7674
:sentry-samples:sentry-samples-spring-jakarta:war \
77-
:sentry-samples:sentry-samples-spring-jakarta:testClasses \
78-
:sentry-opentelemetry:sentry-opentelemetry-agent:assemble
75+
:sentry-samples:sentry-samples-spring-jakarta:testClasses
7976
8077
- name: Test sentry-spring-boot-jakarta integration suites
8178
run: |
@@ -84,21 +81,8 @@ jobs:
8481
:sentry-spring-boot-jakarta:integrationTestWebflux \
8582
:sentry-spring-boot-jakarta:integrationTestOtelNoAgent \
8683
:sentry-spring-boot-jakarta:integrationTestLog4j2 \
87-
:sentry-spring-boot-jakarta:integrationTestOtelAgent
88-
89-
- name: Test sentry-samples-spring-boot-jakarta-opentelemetry agent init true
90-
run: |
91-
python3 test/system-test-runner.py test \
92-
--module "sentry-samples-spring-boot-jakarta-opentelemetry" \
93-
--agent true \
94-
--auto-init "true"
95-
96-
- name: Test sentry-samples-spring-boot-jakarta-opentelemetry agent init false
97-
run: |
98-
python3 test/system-test-runner.py test \
99-
--module "sentry-samples-spring-boot-jakarta-opentelemetry" \
100-
--agent true \
101-
--auto-init "false"
84+
:sentry-spring-boot-jakarta:integrationTestOtelAgent \
85+
:sentry-spring-boot-jakarta:integrationTestOtelAgentWithoutAutoInit
10286
10387
- name: Test sentry-samples-spring-jakarta
10488
run: |

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

Lines changed: 1 addition & 10 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:
@@ -34,15 +34,6 @@ jobs:
3434
- sample: "sentry-samples-spring-boot-opentelemetry"
3535
agent: "true"
3636
agent-auto-init: "false"
37-
- sample: "sentry-samples-spring-boot-jakarta-opentelemetry"
38-
agent: "true"
39-
agent-auto-init: "true"
40-
- sample: "sentry-samples-spring-boot-jakarta-opentelemetry"
41-
agent: "true"
42-
agent-auto-init: "false"
43-
- sample: "sentry-samples-console"
44-
agent: "false"
45-
agent-auto-init: "true"
4637
- sample: "sentry-samples-console-otlp"
4738
agent: "false"
4839
agent-auto-init: "true"

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

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

1312
group = "io.sentry.sample.spring-boot-jakarta"
@@ -61,17 +60,6 @@ dependencies {
6160
// database query tracing
6261
implementation(projects.sentryJdbc)
6362
runtimeOnly(libs.hsqldb)
64-
65-
testImplementation(kotlin(Config.kotlinStdLib))
66-
testImplementation(projects.sentrySystemTestSupport)
67-
testImplementation(libs.apollo3.kotlin)
68-
testImplementation(libs.kotlin.test.junit)
69-
testImplementation(libs.slf4j2.api)
70-
testImplementation(libs.springboot3.starter.test) {
71-
exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
72-
}
73-
testImplementation("ch.qos.logback:logback-classic:1.5.16")
74-
testImplementation("ch.qos.logback:logback-core:1.5.16")
7563
}
7664

7765
tasks.register<BootRun>("bootRunWithAgent").configure {
@@ -105,25 +93,3 @@ tasks.register<BootRun>("bootRunWithAgent").configure {
10593

10694
jvmArgs = listOf("-Dotel.javaagent.debug=true", "-javaagent:$agentJarPath")
10795
}
108-
109-
// The runner launches this sample with -javaagent, so track the agent jar as a systemTest input.
110-
sentrySystemTest { usesOpenTelemetryAgent = true }
111-
112-
tasks.register<Test>("systemTest").configure {
113-
group = "verification"
114-
description = "Runs the System tests"
115-
116-
val test = project.extensions.getByType<SourceSetContainer>()["test"]
117-
testClassesDirs = test.output.classesDirs
118-
classpath = test.runtimeClasspath
119-
120-
maxParallelForks = 1
121-
122-
filter { includeTestsMatching("io.sentry.systemtest*") }
123-
}
124-
125-
tasks.named("test").configure {
126-
require(this is Test)
127-
128-
filter { excludeTestsMatching("io.sentry.systemtest.*") }
129-
}

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

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

‎sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt‎

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

0 commit comments

Comments
 (0)