Skip to content

Commit 1b46292

Browse files
runningcodeclaude
andcommitted
test(spring-boot): Drop Spring Boot 2.4 to 2.6 from the test matrix
Spring Boot 2.4 to 2.6 are long past end of life. They were the only reason the Boot 2 suites left GraphQL and Kafka out of their compilation below 2.7, which stands in the way of compiling the suites once and running them on each Boot version's classpath (JAVA-802). The Kafka beans stay in a profile, so only the Kafka tests need a broker. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 07a8d1b commit 1b46292

8 files changed

Lines changed: 32 additions & 56 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
strategy:
2222
fail-fast: false
2323
matrix:
24-
springboot-version: [ '2.4.13', '2.5.15', '2.6.15', '2.7.0', '2.7.18' ]
24+
springboot-version: [ '2.7.0', '2.7.18' ]
2525

2626
name: Spring Boot ${{ matrix.springboot-version }}
2727
env:

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

Lines changed: 20 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ tasks.named<KotlinCompile>("compileKotlin") {
2121

2222
// Spring scans the integration test apps' own bytecode with its repackaged ASM at startup, and
2323
// the ASM in Spring before 5.3.26 fails on class files as new as the toolchain's: "Unsupported
24-
// class file major version 65". In the Spring Boot 2.x matrix, 2.4.13 (Spring 5.3.13) reads up
25-
// to Java 18 and 2.7.0 (Spring 5.3.20) up to Java 19, so the suites target 17. Remove this once
26-
// the matrix drops 2.4.13 and moves 2.7.0 to 2.7.10 or later.
24+
// class file major version 65". The Spring Boot 2.x matrix's 2.7.0 (Spring 5.3.20) reads up to
25+
// Java 19, so the suites target 17. Remove this once the matrix moves 2.7.0 to 2.7.10 or later.
2726
// The suites are Kotlin only. Their Java tasks keep the toolchain's level, because it decides
2827
// which Java version their classpaths ask for, and sentry-test-support needs the toolchain's.
2928
tasks
@@ -137,13 +136,6 @@ tasks.jar {
137136
}
138137
}
139138

140-
// Spring Boot supports GraphQL only from 2.7, and its Kafka auto-configuration needs 2.7 for the
141-
// spring-kafka version Sentry integrates with. The Spring Boot 2 matrix also covers older versions.
142-
val bootSupportsGraphqlAndKafka =
143-
libs.versions.springboot2.get().split(".").let { (major, minor) ->
144-
major.toInt() > 2 || minor.toInt() >= 7
145-
}
146-
147139
// The OpenTelemetry agent tests run this app in a child JVM, on its own classpath like a real app
148140
// with the agent attached, rather than on the test's classpath.
149141
val agentFixture = sourceSets.create("agentFixture")
@@ -164,20 +156,18 @@ dependencies {
164156
"agentFixtureImplementation"(platform(libs.springboot2.bom))
165157
"agentFixtureImplementation"(projects.sentrySpringBootStarter)
166158
"agentFixtureImplementation"(projects.sentryAsyncProfiler)
159+
"agentFixtureImplementation"(projects.sentryGraphql)
167160
"agentFixtureImplementation"(projects.sentryJdbc)
161+
"agentFixtureImplementation"(projects.sentryKafka)
168162
"agentFixtureImplementation"(projects.sentryLogback)
169163
"agentFixtureImplementation"(kotlin(Config.kotlinStdLib))
170164
"agentFixtureImplementation"(libs.otel)
165+
"agentFixtureImplementation"(libs.springboot.starter.graphql)
171166
"agentFixtureImplementation"(libs.springboot.starter.jdbc)
172167
"agentFixtureImplementation"(libs.springboot.starter.web)
173168
"agentFixtureImplementation"(libs.springboot.starter.webflux)
169+
"agentFixtureImplementation"(libs.spring.kafka2)
174170
"agentFixtureRuntimeOnly"(libs.hsqldb)
175-
if (bootSupportsGraphqlAndKafka) {
176-
"agentFixtureImplementation"(projects.sentryGraphql)
177-
"agentFixtureImplementation"(projects.sentryKafka)
178-
"agentFixtureImplementation"(libs.springboot.starter.graphql)
179-
"agentFixtureImplementation"(libs.spring.kafka2)
180-
}
181171

182172
otelAgentJar(projects.sentryOpentelemetry.sentryOpentelemetryAgent)
183173
}
@@ -192,7 +182,9 @@ testing {
192182
implementation(platform(libs.springboot2.bom))
193183
implementation(projects.sentrySpringBootStarter)
194184
implementation(projects.sentryAsyncProfiler)
185+
implementation(projects.sentryGraphql)
195186
implementation(projects.sentryJdbc)
187+
implementation(projects.sentryKafka)
196188
implementation(projects.sentryLogback)
197189
implementation(projects.sentryOkhttp)
198190
implementation(projects.sentryTestSupport)
@@ -202,18 +194,14 @@ testing {
202194
implementation(libs.okhttp)
203195
implementation(libs.springboot.starter.aop)
204196
implementation(libs.springboot.starter.cache)
197+
implementation(libs.springboot.starter.graphql)
205198
implementation(libs.springboot.starter.jdbc)
206199
implementation(libs.springboot.starter.test)
207200
implementation(libs.springboot.starter.web)
208201
implementation(libs.springboot.starter.webflux)
202+
implementation(libs.spring.kafka2)
203+
implementation(libs.spring.kafka2.test)
209204
runtimeOnly(libs.hsqldb)
210-
if (bootSupportsGraphqlAndKafka) {
211-
implementation(projects.sentryGraphql)
212-
implementation(projects.sentryKafka)
213-
implementation(libs.springboot.starter.graphql)
214-
implementation(libs.spring.kafka2)
215-
implementation(libs.spring.kafka2.test)
216-
}
217205
}
218206
}
219207

@@ -224,16 +212,14 @@ testing {
224212
implementation(platform(libs.springboot2.bom))
225213
implementation(projects.sentrySpringBootStarter)
226214
implementation(projects.sentryAsyncProfiler)
215+
implementation(projects.sentryGraphql)
227216
implementation(projects.sentryLogback)
228217
implementation(projects.sentryTestSupport)
229218
implementation(libs.kotlin.test.junit)
230219
implementation(libs.google.truth)
220+
implementation(libs.springboot.starter.graphql)
231221
implementation(libs.springboot.starter.test)
232222
implementation(libs.springboot.starter.webflux)
233-
if (bootSupportsGraphqlAndKafka) {
234-
implementation(projects.sentryGraphql)
235-
implementation(libs.springboot.starter.graphql)
236-
}
237223
}
238224
}
239225

@@ -246,24 +232,22 @@ testing {
246232
implementation(projects.sentrySpringBootStarter)
247233
implementation(projects.sentryOpentelemetry.sentryOpentelemetryAgentlessSpring)
248234
implementation(projects.sentryAsyncProfiler)
235+
implementation(projects.sentryGraphql)
249236
implementation(projects.sentryJdbc)
237+
implementation(projects.sentryKafka)
250238
implementation(projects.sentryLogback)
251239
implementation(projects.sentryTestSupport)
252240
implementation(libs.kotlin.test.junit)
253241
implementation(libs.google.truth)
254242
implementation(libs.springboot.starter.aop)
243+
implementation(libs.springboot.starter.graphql)
255244
implementation(libs.springboot.starter.jdbc)
256245
implementation(libs.springboot.starter.test)
257246
implementation(libs.springboot.starter.web)
258247
implementation(libs.springboot.starter.webflux)
248+
implementation(libs.spring.kafka2)
249+
implementation(libs.spring.kafka2.test)
259250
runtimeOnly(libs.hsqldb)
260-
if (bootSupportsGraphqlAndKafka) {
261-
implementation(projects.sentryGraphql)
262-
implementation(projects.sentryKafka)
263-
implementation(libs.springboot.starter.graphql)
264-
implementation(libs.spring.kafka2)
265-
implementation(libs.spring.kafka2.test)
266-
}
267251
}
268252
}
269253

@@ -278,9 +262,7 @@ testing {
278262
// For TestRestTemplate. Only the app's JVM runs the agent, so it doesn't trace the tests.
279263
implementation(libs.springboot.starter.test)
280264
implementation(libs.springboot.starter.web)
281-
if (bootSupportsGraphqlAndKafka) {
282-
implementation(libs.spring.kafka2.test)
283-
}
265+
implementation(libs.spring.kafka2.test)
284266
}
285267
targets.all { testTask.configure { runAgentFixture(autoInit = true) } }
286268
}
@@ -324,10 +306,5 @@ listOf(
324306
"compileIntegrationTestOtelAgentKotlin",
325307
)
326308
.forEach {
327-
tasks.named<KotlinCompile>(it) {
328-
compilerOptions.javaParameters = true
329-
if (!bootSupportsGraphqlAndKafka) {
330-
exclude("**/Graphql*", "**/Greeting*", "**/Kafka*")
331-
}
332-
}
309+
tasks.named<KotlinCompile>(it) { compilerOptions.javaParameters = true }
333310
}

‎sentry-spring-boot/src/agentFixture/kotlin/io/sentry/spring/boot/agentfixture/KafkaController.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import org.springframework.web.bind.annotation.RestController
1111

1212
const val KAFKA_TOPIC = "sentry-topic"
1313

14-
// Kafka only works with Spring Boot 2.7 and later, so its beans belong to a profile rather than to
15-
// the app most tests share. See KafkaOtelCoexistenceIntegrationTest.
14+
// The beans belong to a profile, so only the app KafkaOtelCoexistenceIntegrationTest starts needs a
15+
// broker.
1616

1717
@RestController
1818
@Profile("kafka")

‎sentry-spring-boot/src/integrationTest/kotlin/io/sentry/spring/boot/integrationtest/KafkaController.kt‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ import org.springframework.web.bind.annotation.RestController
1111

1212
const val KAFKA_TOPIC = "sentry-topic"
1313

14-
// Kafka only works with Spring Boot 2.7 and later, so its beans and broker belong to a profile
15-
// rather than to every test's context. See KafkaIntegrationTest.
14+
// The beans belong to a profile, so only KafkaIntegrationTest's context needs a broker.
1615

1716
@RestController
1817
@Profile("kafka")

‎sentry-spring-boot/src/integrationTest/kotlin/io/sentry/spring/boot/integrationtest/KafkaIntegrationTest.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import org.springframework.test.context.TestPropertySource
1111
/**
1212
* A message sent through Kafka is traced on both sides: where it's published and processed.
1313
*
14-
* Unlike the other tests, this one runs its own application context with an in-JVM broker, because
15-
* the shared context has to work on Spring Boot versions without Kafka support.
14+
* Unlike the other tests, this one runs its own application context with an in-JVM broker, so the
15+
* shared context doesn't need one.
1616
*/
1717
@ActiveProfiles("kafka")
1818
@EmbeddedKafka(topics = [KAFKA_TOPIC], bootstrapServersProperty = "spring.kafka.bootstrap-servers")

‎sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/KafkaOtelCoexistenceIntegrationTest.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import org.springframework.kafka.test.EmbeddedKafkaBroker
1212
* With the agent active, OpenTelemetry traces Kafka instead of Sentry's own Spring Kafka
1313
* integration.
1414
*
15-
* Unlike the other tests, this one starts an app of its own, with Kafka and an in-JVM broker. The
16-
* shared app leaves them out, because it has to work on Spring Boot versions without Kafka support.
15+
* Unlike the other tests, this one starts an app of its own, with Kafka and an in-JVM broker, so
16+
* the shared app doesn't need a broker.
1717
*/
1818
class KafkaOtelCoexistenceIntegrationTest : IntegrationTest() {
1919
override val app: AgentApp

‎sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/KafkaController.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import org.springframework.web.bind.annotation.RestController
1111

1212
const val KAFKA_TOPIC = "sentry-topic"
1313

14-
// Kafka only works with Spring Boot 2.7 and later, so its beans and broker belong to a profile
15-
// rather than to every test's context. See KafkaOtelCoexistenceIntegrationTest.
14+
// The beans belong to a profile, so only KafkaOtelCoexistenceIntegrationTest's context needs a
15+
// broker.
1616

1717
@RestController
1818
@Profile("kafka")

‎sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/KafkaOtelCoexistenceIntegrationTest.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import org.springframework.test.context.TestPropertySource
1111
/**
1212
* With OpenTelemetry active, it traces Kafka instead of Sentry's own Spring Kafka integration.
1313
*
14-
* Unlike the other tests, this one adds Kafka and an in-JVM broker to its application context. The
15-
* others leave them out, because they have to work on Spring Boot versions without Kafka support.
14+
* Unlike the other tests, this one adds Kafka and an in-JVM broker to its application context, so
15+
* the others don't need a broker.
1616
*/
1717
@ActiveProfiles("kafka")
1818
@EmbeddedKafka(topics = [KAFKA_TOPIC], bootstrapServersProperty = "spring.kafka.bootstrap-servers")

0 commit comments

Comments
 (0)