-
Notifications
You must be signed in to change notification settings - Fork 40.8k
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
Consider automatically applying @DirtiesContext to Testcontainer tests #38237
Comments
@philwebb This seems interesting, can I take this issue? After a quick look, I think I can solve it by creating a class that inherits from 'AbstractTestExecutionListener'. Something like 'TestcontainersTestExecutionListener' similar to 'DirtiesContextTestExecutionListener'... Is it okay to proceed in this way? |
@kth496 I'd like to discuss this issue a little more as a team before we make any concrete decisions. |
@philwebb What do you mean by
If you mean that any test class that is annotated with I think, the lifecycle mismatch between Spring context shutdown and Testcontainers shutdown should be fixed in some other way. In a way that will make sure that containers are not stopped before Spring contexts are fully stopped. This is especially important for containers with DB with migration applied. Usually such container is started only once per all integration tests. Marking every integration test with |
See #38176 for an example of a problem caused by a mismatch of the test containers and spring lifecycle. It would be nice if we could prevent users from hitting the same problem.
The text was updated successfully, but these errors were encountered: