feat(termination)!: make container termination timeout configurable#2926
feat(termination)!: make container termination timeout configurable#2926mdelapenya merged 13 commits intotestcontainers:mainfrom
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
stevenh
left a comment
There was a problem hiding this comment.
Thanks for PR, seems like a good idea, unfortunately this approach doesn't work with an interface design, see comments for details.
stevenh
left a comment
There was a problem hiding this comment.
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 😊 |
stevenh
left a comment
There was a problem hiding this comment.
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
stevenh
left a comment
There was a problem hiding this comment.
Sorry missed a bug in the last review
stevenh
left a comment
There was a problem hiding this comment.
Thanks for all your work on this, looks good to me.
mdelapenya
left a comment
There was a problem hiding this comment.
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
mdelapenya
left a comment
There was a problem hiding this comment.
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) ...
|
|
||
| // 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.
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.terminationOptionsunder 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.0Terminate()require handle for errors"is already in progress"testing.TBso 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