Skip to content

v4.0.0-beta.3

Pre-release
Pre-release

Choose a tag to compare

@aeneasr aeneasr released this 17 Mar 14:12
· 11 commits to v4 since this release
fa8f486
refactor: replace Managed* wrappers with interfaces (#655)

* refactor: replace Managed* wrappers with interfaces

Replace the concrete ManagedResource, ManagedPool, and ManagedNetwork
wrapper structs with Go interfaces. The *T variants now return the
restricted interface (Resource, Pool, Network) while the non-T variants
return the closable interface (ClosableResource, ClosablePool,
ClosableNetwork).

Key changes:
- Define Resource/ClosableResource, Network/ClosableNetwork,
  Pool/ClosablePool interfaces
- Unexport Pool struct → pool, Network struct → dockerNetwork
- Remove ~115 lines of manual delegation boilerplate
- ConnectToNetwork/DisconnectFromNetwork/GetIPInNetwork now accept the
  Network interface directly, removing the ManagedNetwork.Network()
  escape hatch
- Add NewResource constructor for external unit tests
- Convert examples/cleanup/main.go to TestExplicitCleanup test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: fix three inaccuracies in UPGRADE.md

- var pool *dockertest.Pool → var pool dockertest.ClosablePool
  (pointer-to-interface is meaningless; NewPool returns ClosablePool)
- CloseT example: RunT returns Resource (no CloseT); use Run to get
  ClosableResource when explicit teardown is needed
- Registry function signatures: add return types (error, bool, slice)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: apply formatting

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>