Skip to content

Commit 1c126a9

Browse files
committed
Restore second test
1 parent 6ef4819 commit 1c126a9

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

packages/testcontainers/src/wait-strategies/log-wait-strategy.test.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,20 @@ describe("LogWaitStrategy", { timeout: 180_000 }, () => {
5656
});
5757

5858

59+
it("should throw an error if the message is never received", async () => {
60+
const containerName = `container-${new RandomUuid().nextUuid()}`;
61+
62+
await expect(
63+
new GenericContainer("cristianrgreco/testcontainer:1.1.14")
64+
.withName(containerName)
65+
.withCommand("/bin/sh", "-c", 'echo "Ready"')
66+
.withWaitStrategy(Wait.forLogMessage("unexpected"))
67+
.start()
68+
).rejects.toThrowError(`Log stream ended and message "unexpected" was not received`);
69+
70+
expect(await getRunningContainerNames()).not.toContain(containerName);
71+
});
72+
5973
it("does not matter if container does not send all content in a single line", async () => {
6074
const container = await new GenericContainer("cristianrgreco/testcontainer:1.1.14")
6175
.withCommand(["node", "-e", "process.stdout.write('Hello '); setTimeout(() => process.stdout.write('World\\n'), 2000)"])
@@ -64,4 +78,4 @@ describe("LogWaitStrategy", { timeout: 180_000 }, () => {
6478

6579
await container.stop();
6680
});
67-
});
81+
});

0 commit comments

Comments
 (0)