When test is annotated with @AutoConfigureObservability and management.baggage.correlation.fields property has any value, then simple GET request via WebTestClient is going to fail with:

java.lang.AssertionError: Misalignment: popped updateScope false !=  expected false
    at brave.baggage.CorrelationFlushScope.popCurrentUpdateScope(CorrelationFlushScope.java:86)
...

Tested it with brave reporter only.

Reproducer is available here: https://github.com/surmabck/spring-boot-3xx-micrometer-issues/blob/main/src/test/kotlin/com/example/demo/DemoApplicationTests.kt#L29

Comment From: wilkinsona

Thanks for the report. This doesn't appear to be specific to tests. The same failure occurs with the main application when management.baggage.correlation.fields is set. It looks very similar to https://github.com/spring-projects/spring-boot/issues/34075 which should have been addressed by https://github.com/micrometer-metrics/tracing/issues/157. The fix is in Micrometer Tracing 1.0.2 which you are using so I suspect there's another problem that can cause a similar failure.

@surmabck, can you please open a Micrometer tracing issue for this? If you comment here with a link to it, we can subscribe and provide any input that's needed from the Spring Boot side of things.

Comment From: surmabck

Linking Micrometer issue -> https://github.com/micrometer-metrics/tracing/issues/175