Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions test/container.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,22 @@ test('should receive container stdout on attach', async () => {
// Wait for container to finish
console.log(' Waiting for container to finish...');
const waitResult = await client.containerWait(containerId);

// Wait for streams to finish writing all data
// This ensures all piped data has been written to our Writable streams
await new Promise<void>((resolve) => {
// Set a timeout in case streams don't emit 'finish' event
const timeout = setTimeout(resolve, 1000);

// Wait for stdout stream to finish
stdout.once('finish', () => {
clearTimeout(timeout);
resolve();
});

// Trigger finish by ending the stream
stdout.end();
});
console.log(
` Container finished with exit code: ${waitResult.StatusCode}`,
);
Expand Down
Loading