-
Notifications
You must be signed in to change notification settings - Fork 142
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
Create containers per test or as a static global? #745
Comments
Hi there 👋 Sorry, but this is duplicate of #707 (and proper solution requires #577). In #707 you can find some workaround how to achieve this even right now, for example: #707 (comment) Closing due to this |
@DDtKey Maybe I should rename the issue, but I dont think the suggested workaround in #707 (comment) is any different from what I have above? I guess I'm not asking for "how to create a single global container", the problem I'm experiencing is that the containers still aren't shut down properly...? I have the |
They are different, take a look at the Anyway, that's a workaround and the issue itself is duplicate - ability to use static containers without tricks. That's how Rust's drop works. It's not called for static variables. So the trick with Weak works if you have parallel tests
|
Kind of related to my previous issue here #727 (comment)
When I use
testcontainers
and create a new container for every tests, I often run into some issue where some of the containers aren't successfully created (maybe a race condition). So then my instinct told me to create a static global container with something like this for the test module:This worked for a while but I soon realized that the clean up of these containers often fail. That is, I'm often left with something like this after a bit of development:
So far I have the
watchdog
feature enabled but this is still happening. I guess my question is, what's the recommended approach here? Is there one or is this a current limitation?The text was updated successfully, but these errors were encountered: