File tree Expand file tree Collapse file tree
sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import org.assertj.core.api.Assertions.assertThat
99import org.springframework.boot.autoconfigure.AutoConfigurations
1010import org.springframework.boot.test.context.FilteredClassLoader
1111import org.springframework.boot.test.context.runner.ApplicationContextRunner
12+ import org.springframework.kafka.core.KafkaTemplate
1213
1314class SentryKafkaAutoConfigurationTest {
1415
@@ -34,6 +35,8 @@ class SentryKafkaAutoConfigurationTest {
3435 private val noSentryKafkaClassLoader =
3536 FilteredClassLoader (SentryKafkaProducerInterceptor ::class .java)
3637
38+ private val noSpringKafkaClassLoader = FilteredClassLoader (KafkaTemplate ::class .java)
39+
3740 @Test
3841 fun `registers Kafka BPPs when queue tracing is enabled` () {
3942 contextRunner
@@ -64,6 +67,17 @@ class SentryKafkaAutoConfigurationTest {
6467 }
6568 }
6669
70+ @Test
71+ fun `does not register Kafka BPPs when spring-kafka is not present` () {
72+ contextRunner
73+ .withClassLoader(noSpringKafkaClassLoader)
74+ .withPropertyValues(" sentry.enable-queue-tracing=true" )
75+ .run { context ->
76+ assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor ::class .java)
77+ assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor ::class .java)
78+ }
79+ }
80+
6781 @Test
6882 fun `does not register Kafka BPPs when queue tracing is explicitly false` () {
6983 contextRunner
You can’t perform that action at this time.
0 commit comments