-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
2.6.0-M1/M2: play.test.WithApplication#stopPlay does not call ApplicationLifecycle-Hooks anymore #7073
Comments
Hi @domdorn, this is a Java project, right? Looking at the current code, we are calling the It calls Is it possible to have a project that reproduces the problem? |
hmm...
yes, its a java project. I'll try to debug further into it tomorrow and see if I can extract a test-project that reproduces the issue (its already quite late here). is provideApplication() called a second time? then I'd probably have to store the instance in a field instead of creating a new one in provideApplication() |
It is called once per test case. So, if your test class has 10 test cases, it will called 10 times. Of course, stop will be called for each test case too. |
Ok, looks like this is from another issue. I had my tests running with "fork in Test := false". |
@domdorn I think we can close this then? |
I'm having troubles with my Unit/Integration Tests while moving to Play 2.6.0 M1/M2.
My tests are extending the play.test.WithApplication class and the play.test.WithApplication#stopPlay is also invoked correctly.
However, the Stop method in play.api.Play#stop does not invoke the ApplicationLifecycle Callbacks anymore.
This leaves my app in an inconsistent state, as I cannot invoke cleanup actions, like closing httpClients that I acquired by doing wsClient.getUnderlying or stopping schedulers in actors.
Especially, this leaves a thread hanging around for (almost) every test I execute, printing the remaining open connections in
/Users/domdorn/.ivy2/cache/com.typesafe.play/shaded-asynchttpclient/jars/shaded-asynchttpclient-1.0.0-M4.jar!/play/shaded/ahc/org/asynchttpclient/netty/channel/DefaultChannelPool.class:289
The text was updated successfully, but these errors were encountered: