Skip to content

chore(wait): apply review suggestions to exit_test and health_test#1

Open
mdelapenya wants to merge 1 commit into
mateenali66:feat/issue-2765-generated-mocks-waitfrom
mdelapenya:fix/pr-3603-review-suggestions-v2
Open

chore(wait): apply review suggestions to exit_test and health_test#1
mdelapenya wants to merge 1 commit into
mateenali66:feat/issue-2765-generated-mocks-waitfrom
mdelapenya:fix/pr-3603-review-suggestions-v2

Conversation

@mdelapenya

Copy link
Copy Markdown

Review feedback from the testcontainers maintainers on PR testcontainers#3603.

Changes

  • wait/exit_test.go and wait/health_test.go migrated from package wait to package wait_test
  • Hand-written mock structs removed; replaced with mockStrategyTarget (already generated and checked in)
  • Typed EXPECT() chains used throughout — consistent with file_test.go and log_test.go
  • anyContext matcher reused for context arguments (not bare mock.Anything)
  • Import paths updated to github.com/moby/moby/api/types/container
  • Typed container.State* constants used instead of raw string literals
  • newStateTarget(t, state) helper extracted in health_test.go, mirroring newRunningTarget pattern
  • TestWaitForHealthWithNil: goroutine+mutex pattern replaced with a RunAndReturn time-based closure

Test results

All 7 tests pass on current main:

--- PASS: TestWaitForExit (0.00s)
--- PASS: TestWaitForHealthTimesOutForUnhealthy (0.20s)
--- PASS: TestWaitForHealthSucceeds (0.00s)
--- PASS: TestWaitForHealthWithNil (0.20s)
--- PASS: TestWaitForHealthFailsDueToOOMKilledContainer (0.00s)
--- PASS: TestWaitForHealthFailsDueToExitedContainer (0.00s)
--- PASS: TestWaitForHealthFailsDueToUnexpectedContainerStatus (0.00s)
ok  github.com/testcontainers/testcontainers-go/wait  0.413s

- Switch to package wait_test
- Replace hand-written mocks with mockStrategyTarget + typed EXPECT() chains
- Use anyContext matcher for context args
- Use moby/moby import paths (not docker/docker)
- Use typed container state constants
- Extract newStateTarget() helper in health_test.go
- Replace goroutine+mutex pattern in TestWaitForHealthWithNil with RunAndReturn closure

Addresses review feedback on PR testcontainers#3603.
@mateenali66 mateenali66 force-pushed the feat/issue-2765-generated-mocks-wait branch from 728129a to 77c1ac7 Compare June 17, 2026 01:49
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