Skip to content

Commit f7e1e0a

Browse files
Stabilize compose wait strategy warning test
1 parent d5ae058 commit f7e1e0a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/testcontainers/src/docker-compose-environment/docker-compose-environment.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,18 +132,21 @@ describe("DockerComposeEnvironment", { timeout: 180_000 }, () => {
132132
});
133133

134134
it("should warn when no started containers match configured wait strategy names", async () => {
135+
const unmatchedWaitStrategyName = "non-existent-container-name";
135136
const warnSpy = vi.spyOn(log, "warn");
136137

137138
await using startedEnvironment = await new DockerComposeEnvironment(fixtures, "docker-compose.yml")
138-
.withWaitStrategy("container", Wait.forLogMessage("Listening on port 8080"))
139+
.withWaitStrategy(unmatchedWaitStrategyName, Wait.forLogMessage("Listening on port 8080"))
139140
.up(["container"]);
140141

141142
await checkEnvironmentContainerIsHealthy(startedEnvironment, await composeContainerName("container"));
142143

143144
const warningMessages = warnSpy.mock.calls.map(([message]) => message);
144145
expect(
145146
warningMessages.some((warningMessage) =>
146-
warningMessage.includes(`No containers were started for the configured wait strategy names: "container"`)
147+
warningMessage.includes(
148+
`No containers were started for the configured wait strategy names: "${unmatchedWaitStrategyName}"`
149+
)
147150
)
148151
).toBe(true);
149152
});

0 commit comments

Comments
 (0)