You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In com.alibaba.csp.sentinel.adapter.jaxrs.ClientFilterTest, the unit test testClientFallback() will fail when run after the unit test testClientCustomFallback().
Similarly, the following unit tests in com.alibaba.csp.sentinel.adapter.jaxrs.ProviderFilterTest will fail when run after the unit test testCustomFallback()
This is because the tests ClientFilterTest.testClientCustomFallback() and ProviderFilterTest.testCustomFallback() pollute the shared state SentinelJaxRsConfig.jaxRsFallback between tests at
However, this state isn't cleaned after the run causing the above mentioned tests to fail
Describe what you expected to happen
The unit tests in com.alibaba.csp.sentinel.adapter.jaxrs.ClientFilterTest and com.alibaba.csp.sentinel.adapter.jaxrs.ProviderFilterTest should pass when run in any order
How to reproduce it (as minimally and precisely as possible)
In com.alibaba.csp.sentinel.adapter.jaxrs.ClientFilterTest, run the following unit tests in order
testClientCustomFallback()
testClientFallback()
In com.alibaba.csp.sentinel.adapter.jaxrs.ProviderFilterTest, run the following unit tests in order
testCustomFallback()
testDefaultFallback() or testCustomRequestOriginParser()
Running the tests in the above manner will produce java.lang.AssertionError
java.lang.AssertionError:
Expected :429
Actual :200
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.failNotEquals(Assert.java:834)
at org.junit.Assert.assertEquals(Assert.java:645)
at org.junit.Assert.assertEquals(Assert.java:631)
at com.alibaba.csp.sentinel.adapter.jaxrs.ClientFilterTest.testClientFallback(ClientFilterTest.java:224)
The exact stacktrace will vary based on the second test executed
Issue Description
Type: bug report
Describe what happened
com.alibaba.csp.sentinel.adapter.jaxrs.ClientFilterTest
, the unit testtestClientFallback()
will fail when run after the unit testtestClientCustomFallback()
.com.alibaba.csp.sentinel.adapter.jaxrs.ProviderFilterTest
will fail when run after the unit testtestCustomFallback()
com.alibaba.csp.sentinel.adapter.jaxrs.ProviderFilterTest.testDefaultFallback()
com.alibaba.csp.sentinel.adapter.jaxrs.ProviderFilterTest.testCustomRequestOriginParser()
ClientFilterTest.testClientCustomFallback()
andProviderFilterTest.testCustomFallback()
pollute the shared stateSentinelJaxRsConfig.jaxRsFallback
between tests atSentinel/sentinel-adapter/sentinel-jax-rs-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/jaxrs/ClientFilterTest.java
Line 233 in 5108046
Sentinel/sentinel-adapter/sentinel-jax-rs-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/jaxrs/ProviderFilterTest.java
Line 168 in 5108046
Describe what you expected to happen
com.alibaba.csp.sentinel.adapter.jaxrs.ClientFilterTest
andcom.alibaba.csp.sentinel.adapter.jaxrs.ProviderFilterTest
should pass when run in any orderHow to reproduce it (as minimally and precisely as possible)
com.alibaba.csp.sentinel.adapter.jaxrs.ClientFilterTest
, run the following unit tests in ordertestClientCustomFallback()
testClientFallback()
com.alibaba.csp.sentinel.adapter.jaxrs.ProviderFilterTest
, run the following unit tests in ordertestCustomFallback()
testDefaultFallback()
ortestCustomRequestOriginParser()
java.lang.AssertionError
Tell us your environment
1.8.6
Mac OS X 14.0 aarch64
17.0.9
or1.8.0_381
Anything else we need to know?
SentinelJaxRsConfig.jaxRsFallback
to its default value in thecleanUp()
method of the respective classes.The text was updated successfully, but these errors were encountered: