New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@RegisterExtension + WireMockExtension: Timing & state issues when using "static" #2702
Comments
Many thanks for including the example project, it really helps when we are looking into the issue. From looking at your test class I was able to narrow it down to the two tests that had the issue - this test I am now wondering if this is a case of one test leaking into another due to state being changed on a static variable? On line wireMock.setGlobalFixedDelay(1000); // Make all requests take way longer than 1s It looks like it is this line that is causing the issues. Setting the global delay in WireMock on a static The reason the final RestClientService service = new RestClientService("http://localhost:" + wireMock.getRuntimeInfo().getHttpPort(), 500); All the other clients are created with no timeout which is why they appear slower but don't fail: final RestClientService restClientService = new RestClientService("http://localhost:" + wireMock.getRuntimeInfo().getHttpPort(), -1); To solve this issue and to keep the wireMock.setGlobalFixedDelay(0); // reset global timeout Or if you want to do it the jUnit way: @BeforeEach
void setUp() {
wireMock.setGlobalFixedDelay(0);
} |
Hi, we are planning on releasing |
Proposal
There seem to be state/timing issues in WireMockExtension. For the following declaration:
it seems that applying "static" to this field, causes a whole other behavior.
To my understanding, all fields and state etc in should be fresh and new for every @test.
Reproduction steps
mvn clean install
Also, run the tests in for example IntelliJ IDEA, or similar. Notice that the tests run rather slowly.
Now, remove the "static" keyword from the WireMockExtension, the tests run a lot faster.
Also notice, when removing the "static" keyword, that the one failing test is actually working.
References
No response
The text was updated successfully, but these errors were encountered: