-
-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement new MultiStrategy design #580
Conversation
Codecov Report
@@ Coverage Diff @@
## main #580 +/- ##
=========================================
- Coverage 13.54% 6.88% -6.66%
=========================================
Files 15 11 -4
Lines 2001 508 -1493
=========================================
- Hits 271 35 -236
+ Misses 1684 470 -1214
+ Partials 46 3 -43
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Do you think the branch was created from main? I see commits from the golangci-lint P. Could you please remove those commits to simplify the review 🙏 ? |
@mdelapenya definitely can separate it out once before I transition it from a draft -> ready for review. I mentioned in the PR body that c3de1bf is the only commit for #559 |
dd3f05e
to
a469e91
Compare
@mdelapenya I've removed the golanglint-ci commits, feel free to take another peek! I haven't had time to add documentation and clean up the existing strategies. If you're comfortable with merging as is I can follow up with Documentation & a Strategy refactor in separate pull requests |
@hhsnopek could you update the docs for all the wait strategies here https://golang.testcontainers.org/features/wait/introduction? 🙏 I think this is the only thing I'm missing at the moment |
design: testcontainers#559 - add: Strategy#Timeout - add: MultiStrategy#WithDeadline - add: NopStrategy & NopStrategyTarget - deprecate: MultiStrategy#WithStartupTimeout
@mdelapenya all set here 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very well structured, thanks for the change. I'm adding a few minor comments that need to be addressed.
Once resolved, I think we can move this little one on.
As always, thanks for your hard work here!
type Strategy interface { | ||
WaitUntilReady(context.Context, StrategyTarget) error | ||
} | ||
|
||
// StrategyTimeout allows MultiStrategy to configure a Strategy's Timeout | ||
type StrategyTimeout interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a follow-up PR, let's add docs on how to create new wait strategies, using both interfaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context
This pull request implements #559, see the design for details.
TODO:
[ ] Refactor/Clean up StrategiesWhile implementing this, I struggled to extend existing strategies due to the use of
Strategy
andStrategyTarget
abstracts. I have implemented or tested my assumptions but using Functional Options instead of Method Chaining would open the API further and expose less of the inner API details. I may suggest this in a future discussion/iteration. For this implementation, I continued the method chaining and was forced to exposeStrategy#Timeout
to check if the wait strategies had a timeout defined.This pull request requires #569 to merge as the work is based on those foundational changes. See c3de1bf for the only commit used for #559
closes #559