Sharing containers across test cases in a test module and cleanup the containers at the end
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 38/100
Research direction
The issue names no source files or tests. Start by reading the crate’s container lifecycle and test support, then check what cleanup hooks cargo/libtest exposes for test modules. Done means there is a way to share containers across cases and clean them up when the module’s tests finish, without relying on reusable containers.
Written by the indexing model from the issue text.
Description
Is there a way to share containers across a test module and have the containers cleaned up at the end of the test module execution?
Starting and stopping these containers takes time, so I prefer sharing them and making sure my test cases don't interfere with one another.
For now I am using a LazyLock to share containers across test cases, but I don't manage to clean them up at the end of the run. Unfortunately cargo/libtest, don't provide 'AfterAll' hooks I can register the cleanup in and static state is not dropped when the module finishes testing.
I don't want to rely on the reusable testcontainers feature as these typically remain running after the test module execution.
- Dominant language
- Rust
- Stars
- 1.1k
- Forks
- 206
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from testcontainers/testcontainers-rs
-
Docker host resolution missing default rootless Docker pathPossibly taken @500B claimed this 41 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
testcontainers/testcontainers-rs#1000 ·
Maintainers usually reply within 1 day
-
RUSTSEC-2026-0440Open
Difficulty 2/5 1-3 hours Newbie friendliness 58/100
testcontainers/testcontainers-rs#1007 ·
Maintainers usually reply within 1 day
-
Container keeps running when the startup timeout expires while it is being startedPossibly taken @goloroden claimed this 45 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
testcontainers/testcontainers-rs#997 ·
Maintainers usually reply within 1 day
-
watchdog: concurrent first container starts can panic with "entered unreachable code" in conquer-oncePossibly taken @ispiler claimed this 29 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 58/100
testcontainers/testcontainers-rs#995 ·
Maintainers usually reply within 1 day
-
Proposal to add org.testcontainers=true label for ecosystem consistencyPossibly taken @BrunosGits claimed this 99 days ago. Openenhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
testcontainers/testcontainers-rs#926 ·
Maintainers usually reply within 1 day
All issues in testcontainers/testcontainers-rs
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
storytold/photocraft#20056 ·
Maintainers usually reply within 1 day
-
accessibility agent-ready area:android bug fleet needs-qa
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
-
A-Packaging C-Bug D-Straightforward S-Needs-Triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area:doc bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
bherbruck/solvecraft#26051 ·