Skip to content

fix: force-remove containers on pool cleanup, add ref-counting tests#653

Merged
aeneasr merged 1 commit intov4from
address-cleanup-problem
Mar 13, 2026
Merged

fix: force-remove containers on pool cleanup, add ref-counting tests#653
aeneasr merged 1 commit intov4from
address-cleanup-problem

Conversation

@aeneasr
Copy link
Copy Markdown
Member

@aeneasr aeneasr commented Mar 13, 2026

Summary

  • Fix Pool.cleanup() to force-remove containers regardless of reference count. Previously, cleanup called resource.Close() which respects ref counting, leaving reused containers running when a pool shuts down.
  • Add 5 tests covering the cleanup API and ref-counting behavior with zero prior integration coverage.

Tests added

Test File Type
TestResourceCloseRefCounting run_test.go integration
TestPoolCloseT pool_test.go integration
TestPoolCleanupForceRemovesReusedContainers pool_test.go integration
TestCheckForExistingIncrementsRefCount pool_test.go unit
TestGetWithScopeDoesNotIncrementRefs registry_test.go unit

Test plan

  • go test -short -run 'TestGetWithScopeDoesNotIncrementRefs|TestCheckForExistingIncrementsRefCount' -v -count=1 — unit tests pass
  • go test -run 'TestResourceCloseRefCounting|TestPoolCloseT|TestPoolCleanupForceRemovesReusedContainers' -v -count=1 — integration tests pass
  • go test -v -count=1 ./... — full suite passes with no regressions

🤖 Generated with Claude Code

Pool.cleanup() previously called resource.Close() which respects reference
counting, leaving reused containers running when the pool shuts down. Now
cleanup bypasses ref counting and force-removes all tracked containers.

Adds 5 tests covering the cleanup API and ref-counting behavior:
- TestResourceCloseRefCounting (integration)
- TestPoolCloseT (integration)
- TestPoolCleanupForceRemovesReusedContainers (integration)
- TestCheckForExistingIncrementsRefCount (unit)
- TestGetWithScopeDoesNotIncrementRefs (unit)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@aeneasr aeneasr changed the base branch from v3 to v4 March 13, 2026 14:14
@aeneasr aeneasr merged commit 93b4b49 into v4 Mar 13, 2026
13 checks passed
@aeneasr aeneasr deleted the address-cleanup-problem branch March 13, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant