-
-
Notifications
You must be signed in to change notification settings - Fork 511
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(termination)!: make container termination timeout configurable #2926
feat(termination)!: make container termination timeout configurable #2926
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Thanks for PR, seems like a good idea, unfortunately this approach doesn't work with an interface design, see comments for details.
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.
Thanks for fleshing out what this looks like, I've done a review on how it stands and will discuss with @mdelapenya in the new year the pros and cons of functional options vs require args.
@stevenh thanks for feedback, i have address the comments. looking forward, Happy new year 😊 |
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.
Sorry to be a pain, but looking at what you've done with this, we should actually make the fields private with methods to avoid any ambiguity as to their use by other types, see suggestion in cleanup.go
.
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.
Thanks for the updates, just a few bits I've clarified from previous suggestions, to allow us to get this over the line.
…iner and introduce configuration test
12269a4
to
6f16fa0
Compare
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.
Sorry missed a bug in the last review
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.
Thanks for all your work on this, looks good to me.
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.
I'm still on PTO, being back Jan 2nd, but had time between sweets and meals to take a quick look.
Just a few comments to be addressed, other than that, will approve once resolved.
Thank you both for your time and effort 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.
LGTM, approving it although I added two docs changes.
Will merge this PR right after they are addressed and the CI passes 🤞
Thank you for your work here 🙇
* main: (103 commits) feat(postgres): ssl for postgres (testcontainers#2473) feat(ollama): support calling the Ollama local process (testcontainers#2923) chore(deps): bump jinja2 from 3.1.4 to 3.1.5 (testcontainers#2935) chore(deps): bump sonarsource/sonarcloud-github-action (testcontainers#2933) feat(termination)!: make container termination timeout configurable (testcontainers#2926) chore(deps): bump slackapi/slack-github-action from 1.26.0 to 2.0.0 (testcontainers#2934) chore(deps): bump github/codeql-action from 3.25.15 to 3.28.0 (testcontainers#2932) feat(wait): log sub match callback (testcontainers#2929) fix: Handle nil value in CleanupNetwork (testcontainers#2928) fix: avoid double lock in DockerProvider.DaemonHost() (testcontainers#2900) feat!: build log writer for container request (testcontainers#2925) feat(gcloud)!: add support to seed data when using RunBigQueryContainer (testcontainers#2523) security(deps): bump golang.org/x/crypto from 0.28.0 to 0.31.0 (testcontainers#2916) chore(ci): add Github labels based on PR title (testcontainers#2914) chore(gha): Use official setup-docker-action (testcontainers#2913) chore(ci): enforce conventional commits syntax in PR titles (testcontainers#2911) feat(nats): WithConfigFile - pass a configuration file to nats server (testcontainers#2905) chore: enable implicit default logger only in testing with -v (testcontainers#2877) fix: container binds syntax (testcontainers#2899) refactor(cockroachdb): to use request driven options (testcontainers#2883) ...
@@ -50,7 +50,7 @@ type Container interface { | |||
Stop(context.Context, *time.Duration) error // stop the container | |||
|
|||
// Terminate stops and removes the container and its image if it was built and not flagged as kept. | |||
Terminate(ctx context.Context) error | |||
Terminate(ctx context.Context, opts ...TerminateOption) error |
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.
Hm, I wonder why we need a separate parameter for the timeout when a context is already provided to Terminate()
?
As a user, I expect this to work fine. Does this code not do what is expected?
ctx, _ := context.WithTimeout(context.Background(), time.Second*10)
c.Terminate(ctx)
If a Duration
value is needed (vs reacting to a channel close), ctx.Deadline()
returns a deadline Time
. It seems that there is no need for a new API.
What does this PR do?
Terminate()
method with optional configuration for timeout configuration.terminationOptions
under container to give the ability to make timeout, etc configurable via a functional option.Terminate()
function.Why is it important?
Terminate()
became broken with latest release version with latest release0.34.0
Terminate()
require handle for errors"is already in progress"
testing.TB
so with this change it will give the ability to configure the timeout and move the cleanup logic under termination
Related issues
a unit test added and shall be tested with all the existed pipelines