-
Notifications
You must be signed in to change notification settings - Fork 3.4k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
delay between tests that use DropwizardExtensionsSupport #8174
Comments
Alright so I slept on it and enabled debugging:
It seems that jetty is waiting for HTTP connections to close before shutdown. It happens twice in the log (1s for each connection so it explains my 2s delay). I added a cleanup method to close the HTTP client after each test and that solves the issue, the tests now run as fast as before. @AfterEach
void cleanup() {
this.client.close();
} Am I doing something wrong in my tests? I don't think I'm leaving open connections. Should the documentation be updated to include a cleanup method, or should |
Hi @Athou. The problem you describe is related to the handling of HTTP connections. As the Mozilla docs state, the default value for the Regarding the exception in the Jetty debug logs: The Jetty However, the much cleaner option for Dropwizard is to set this with a client property. Dropwizard 3.x and 4.x use the client.property(Apache5ClientProperties.REUSE_STRATEGY, (ConnectionReuseStrategy) (request, response, context) -> false); That being said, the behavior to keep connections alive is common practice and shouldn't be changes for the testing package IMHO. With this viable workaround, that should be fine. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Hey there,
I've been using dropwizard for CommaFeed for almost 10 years now, thank you for the great work, it's been a joy to work with! 😃
I updated to 4.0.5 from 2.1.6 and everything works fine. However, I just noticed that the integration tests take a lot more time now, there's a ~2s delay between tests during server shutdown that was not happening before:
The regression is noticeable since this commit Athou/commafeed@fd0e542
The delay does not seem to happen when the app is shutdown when running normally, it only seem to happen when tests annotated with
@ExtendWith(DropwizardExtensionsSupport.class)
are running.Is this something you noticed too? Do you have any pointers as to where to look or why this is happening?
Thanks!
The text was updated successfully, but these errors were encountered: