chore(wait): apply review suggestions to exit_test and health_test (follow-up to #3603)#3724
Conversation
- 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.
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
Summary by CodeRabbit
WalkthroughTests for the wait package exit and health strategies are refactored to use external package testing ( ChangesWait Strategy Test External Package Refactoring
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Closing — reopening correctly targeted against the author's fork branch feat/issue-2765-generated-mocks-wait. |
This is a follow-up to #3603, demonstrating the review feedback applied and passing tests.
Changes vs #3603
wait/exit_test.goandwait/health_test.gomigrated frompackage waittopackage wait_testmockStrategyTarget(already generated, already checked in)EXPECT()chains used throughout (.EXPECT().State(anyContext).Return(...)) — consistent withfile_test.goandlog_test.goanyContextmatcher reused for context argumentsgithub.com/moby/moby/api/types/containercontainer.State*constants used instead of raw string literalsnewStateTarget(t, state)helper extracted inhealth_test.go, mirroringnewRunningTargetpatternTestWaitForHealthWithNil: goroutine+mutex pattern replaced with aRunAndReturntime-based closure — no goroutines, same semantics, cleanerTest results
go build ./wait/...andgo vet ./wait/...are clean.Part of #2765.