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
The tests in org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsIntegrationTests, specifically requestMappingIsInstrumented() and restTemplateIsInstrumented() are not idempotent, since they pollute the state registry
AssertionFailedError log when restTemplateIsInstrumented was run twice in the same JVM
org.opentest4j.AssertionFailedError:
expected: 1L
but was: 2L
at [email protected]/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at [email protected]/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at [email protected]/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at [email protected]/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at app//org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsIntegrationTests.restTemplateIsInstrumented(MetricsIntegrationTests.java:111)
AssertionFailedError log when requestMappingIsInstrumented was run twice in the same JVM
org.awaitility.core.ConditionTimeoutException: Assertion condition defined as a org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsIntegrationTests
expected: 1L
but was: 2L within 5 seconds.
at app//org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
at app//org.awaitility.core.AssertionCondition.await(AssertionCondition.java:119)
at app//org.awaitility.core.AssertionCondition.await(AssertionCondition.java:31)
at app//org.awaitility.core.ConditionFactory.until(ConditionFactory.java:985)
at app//org.awaitility.core.ConditionFactory.untilAsserted(ConditionFactory.java:769)
at app//org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsIntegrationTests.requestMappingIsInstrumented(MetricsIntegrationTests.java:118)
Cause
Each of the above mentioned tests pollutes the shared state registry across test runs, which causes the second test run to fail for assertions on the registry's timer count
Issue
org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsIntegrationTests
, specificallyrequestMappingIsInstrumented()
andrestTemplateIsInstrumented()
are not idempotent, since they pollute the stateregistry
AssertionFailedError
log whenrestTemplateIsInstrumented
was run twice in the same JVMAssertionFailedError
log whenrequestMappingIsInstrumented
was run twice in the same JVMCause
registry
across test runs, which causes the second test run to fail for assertions on theregistry
's timer countspring-boot/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/test/MetricsIntegrationTests.java
Line 110 in 212b80a
spring-boot/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/test/MetricsIntegrationTests.java
Line 117 in 212b80a
Steps to reproduce
@RepeatedTest(2)
Proposed Fix
registry
's timer state is polluted across different runs, I have reset theregistry
state before each test runsetUp()
with@BeforeEach
where theregistry
state is cleared usingthis.registry.clear()
The text was updated successfully, but these errors were encountered: