Skip to content

Add auto cleanup control for containers and compose environments#1293

Merged
cristianrgreco merged 1 commit intomainfrom
codex/compose-environment-reuse-1291
Apr 8, 2026
Merged

Add auto cleanup control for containers and compose environments#1293
cristianrgreco merged 1 commit intomainfrom
codex/compose-environment-reuse-1291

Conversation

@cristianrgreco
Copy link
Copy Markdown
Collaborator

Summary

  • add withAutoCleanup(boolean) to GenericContainer and DockerComposeEnvironment
  • skip Ryuk registration for resources configured with withAutoCleanup(false) while keeping automatic cleanup enabled by default
  • document the new behavior and add focused tests that verify reaper registration is enabled by default and skipped when auto cleanup is disabled

Verification

  • npm run format
  • npm run lint
  • npm run test -- packages/testcontainers/src/generic-container/generic-container-auto-cleanup.test.ts packages/testcontainers/src/docker-compose-environment/docker-compose-environment-auto-cleanup.test.ts

Test results

  • format passed
  • lint passed
  • targeted auto-cleanup test suites passed

Non-breaking evidence

Automatic cleanup remains the default for both containers and compose environments. The new behavior is opt-in via withAutoCleanup(false), so existing call sites keep their current cleanup semantics.

Closes #1291

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 7, 2026

Deploy Preview for testcontainers-node ready!

Name Link
🔨 Latest commit 31708b3
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-node/deploys/69d5177208e9100008067353
😎 Deploy Preview https://deploy-preview-1293--testcontainers-node.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@cristianrgreco cristianrgreco added enhancement New feature or request minor Backward compatible functionality labels Apr 7, 2026 — with ChatGPT Codex Connector
@cristianrgreco cristianrgreco marked this pull request as ready for review April 7, 2026 15:46
@cristianrgreco cristianrgreco merged commit 4b470b5 into main Apr 8, 2026
348 checks passed
@cristianrgreco cristianrgreco deleted the codex/compose-environment-reuse-1291 branch April 8, 2026 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request minor Backward compatible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reusing docker compose stacks between test runs

1 participant