Fix #31: "should receive container stdout on attach" by ensuring stream data is fully written#37
Open
MattHandzel wants to merge 1 commit intodocker:mainfrom
Open
Conversation
The 'should receive container stdout on attach' test was intermittently failing because it didn't wait for stream data to be fully written before asserting. After containerWait() completes, explicitly wait for the stdout stream to finish by calling stream.end() and listening for the 'finish' event. This ensures all piped data has been written to the stdoutData array before assertions. Signed-off-by: MattHandzel <handzelmatthew@gmail.com>
ndeloof
approved these changes
Oct 14, 2025
Collaborator
|
Thanks a lot for your contribution. |
Collaborator
|
I guess this issue is fixed by https://github.com/docker/node-sdk/pull/47/files#diff-406198e18bb578d844d48953e9187cb6a344bf35063fa9d29e7efbec88c39c25R452-R455 |
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
Fixes #31 "investigate flaky test"
- How I did it
Explicitly waiting for stdout stream to finish by calling stream.end() and listening for the 'finish' event. This ensures all piped data has been written to the stdoutData array before any test assertions, which fixes flaky behavior.
- How to verify it
Run
npm test -- --run "test/container.test.ts" -t "should receive container stdout on attach"until you are convinced it is no longer flaky. (I ran it 200 times)- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)
