Skip to content

Conversation

@MattHandzel
Copy link

- 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)
image

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>
@MattHandzel MattHandzel requested a review from wmluke as a code owner October 12, 2025 21:20
@ndeloof
Copy link
Collaborator

ndeloof commented Oct 14, 2025

Thanks a lot for your contribution.
Please run npm run format to fix CI

@ndeloof
Copy link
Collaborator

ndeloof commented Oct 14, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

investigate flaky test

2 participants