Spring-cloud-sleuth: Missing Tracer#currentSpan() in tests alongside spring security

Created on 18 Dec 2018  路  7Comments  路  Source: spring-cloud/spring-cloud-sleuth

Bug report
Hi, I recently upgraded to Greenwich RC1 and stumbled upon a weird issue (which did not happen with Finchley).
In a Controller test (WebTestClient) I have 2 tests doing the exact same thing (getting current span back). First test to be executed works fine but second fails because brave.Tracer#currentSpan() is null. This only happens if I bring spring-security-test in the mix.
My first naive guess is that it might come from ReactorContextTestExecutionListener but haven't had time to investigate further.
Reproducer is here
Thanks

help wanted

Most helpful comment

I confirm it works back with spring-security-test:5.1.3-BUILD-SNAPSHOT
Thanks a lot @bsideup

All 7 comments

The workaround is to use DirtiesContext

@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)

Other than that I guess we'll need help from @smaldini or @bsideup :|

or @simonbasle :)

@beltram could you please share your exact Spring Security's version?
I remember some issues with testing + Spring Security:
https://github.com/spring-projects/spring-security/issues/6075

@bsideup I'm using Spring Security 5.1.2.RELEASE

@beltram ok, the issue I referred was fixed in Spring Security Test 5.1.3.RELEASE. Could you please try it? If I understand correctly, only the testing module needs to be updated, in case you don't want to update the whole Spring Security framework

I confirm it works back with spring-security-test:5.1.3-BUILD-SNAPSHOT
Thanks a lot @bsideup

Cool! I'm closing the issue. Thanks @bsideup, you're the best!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gerasimovv88 picture gerasimovv88  路  7Comments

marcingrzejszczak picture marcingrzejszczak  路  6Comments

dsyer picture dsyer  路  8Comments

gasperlf picture gasperlf  路  4Comments

oburgosm picture oburgosm  路  4Comments