Skip to content

Commit d9cebc4

Browse files
committed
Stop BaggagePropagationIntegrationTests from being flaky
Depending on what tests had already run, Otel tests in BaggagePropagationIntegrationTests could fail due to missing baggage related entries in the MDC. The entries were missing if Otel's ContextStorageWrappers had been marked as initialized without an EventPublishingContextWrapper containing event publisher that will publish to Slf4JBaggageEventListener. ContextStorageWrappers uses a static so this commit avoids to problem by forking a new classpath in BaggagePropagationIntegrationTests. This ensures that any previous static state in ContextStorageWrappers has no effect upon BaggagePropagationIntegrationTests.
1 parent 375b3b1 commit d9cebc4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/BaggagePropagationIntegrationTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.springframework.boot.actuate.autoconfigure.opentelemetry.OpenTelemetryAutoConfiguration;
3434
import org.springframework.boot.autoconfigure.AutoConfigurations;
3535
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
36+
import org.springframework.boot.testsupport.classpath.ForkedClassPath;
3637
import org.springframework.context.ApplicationContext;
3738

3839
import static org.assertj.core.api.Assertions.assertThat;
@@ -44,6 +45,7 @@
4445
* @author Marcin Grzejszczak
4546
* @author Moritz Halbritter
4647
*/
48+
@ForkedClassPath
4749
class BaggagePropagationIntegrationTests {
4850

4951
private static final String COUNTRY_CODE = "country-code";

0 commit comments

Comments
 (0)