client: refactor ContainerWait to use client defined options/results structs#51312
Merged
thaJeztah merged 1 commit intomoby:masterfrom Oct 29, 2025
Merged
Conversation
…structs Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the ContainerWait API to use structured options and results instead of passing a raw condition string and returning separate channels. The refactoring introduces ContainerWaitOptions to encapsulate the wait condition and ContainerWaitResult to bundle the result and error channels together.
Key Changes:
- Introduced
ContainerWaitOptionsstruct with aConditionfield to replace the rawcontainer.WaitConditionparameter - Introduced
ContainerWaitResultstruct containingResultsandErrorschannels to replace the separate channel return values - Updated the
ContainerWaitmethod signature across client implementation and interface definition
Reviewed Changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| client/container_wait.go | Defines new ContainerWaitOptions and ContainerWaitResult types; updates ContainerWait implementation to use these structs |
| client/client_interfaces.go | Updates ContainerAPIClient interface signature for ContainerWait |
| client/container_wait_test.go | Updates unit tests to use new API with ContainerWaitOptions{} and access channels via wait.Results and wait.Errors |
| integration/container/wait_test.go | Updates integration tests to use the refactored API |
| integration/container/daemon_linux_test.go | Updates daemon integration test to use the refactored API |
| integration/container/create_test.go | Updates container creation test to use the refactored API |
| integration-cli/docker_api_containers_test.go | Updates CLI integration test to use the refactored API |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
thaJeztah
approved these changes
Oct 29, 2025
Comment on lines
+21
to
+25
| // ContainerWaitResult defines the result of a container wait operation. | ||
| type ContainerWaitResult struct { | ||
| Results <-chan container.WaitResponse | ||
| Errors <-chan error | ||
| } |
Member
There was a problem hiding this comment.
I think this always returns a single result (it blocks until it's reaching the desired state).
But I may have a look at follow-ups; wondering if we should
- add an explicit
Timeoutoption in the options; this would setcontext.WithTimeoutunder the hood. - abstract away the channel, and just make the function blocking
- but we may need to have some options for an
Ack()method for situations where the wait must be registered before starting the container 🤔
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
- What I did
#50965
This change refactors the client
ContainerWaitimplementation to take and return client defined options/result structs. This is to decouple the client from API changes.- How I did it
- How to verify it
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)