Use writableEnded to determine whether logStream was closed during test

When asserting whether the logStream is closed, the .closed prop is not sufficient.
The prop only becomes true when all the data has been flushed, which probably happens after
we want to do the assertion. By using .writableEnded, we can properly check whether
the logStream was intentionally closed, as it becomes true as soon as .end() is called.

Signed-off-by: ovalice <31350208+ovalice@users.noreply.github.com>
This commit is contained in:
ovalice
2024-04-07 00:29:27 +02:00
parent 8ccbdb2dbf
commit bc4ab9fcf6
@@ -203,7 +203,7 @@ describeIfKubernetes('KubernetesContainerRunner', () => {
await containerRunner.runContainer(runOptions);
expect(logStream.closed).toBe(false);
expect(logStream.writableEnded).toBe(false);
});
describe('with namespace test', () => {