Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@ services:
ports:
- 8080
healthcheck:
test: "curl -f http://localhost:8080/hello-world || exit 1"
interval: 1s
timeout: 1s
retries: 1
start_period: 10s
test: "sleep 10"
timeout: 10s
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,16 @@ describe("DockerComposeEnvironment", { timeout: 180_000 }, () => {
).rejects.toThrow(`Health check failed: unhealthy`);
});

if (!process.env.CI_PODMAN) {
it("should stop the container when the health check wait strategy times out", async () => {
await expect(
new DockerComposeEnvironment(fixtures, "docker-compose-with-healthcheck-with-start-period.yml")
.withWaitStrategy(await composeContainerName("container"), Wait.forHealthCheck())
.withStartupTimeout(0)
.up()
).rejects.toThrow(`Health check not healthy after 0ms`);

expect(await getRunningContainerNames()).not.toContain("container_1");
});
}
it("should stop the container when the health check wait strategy times out", async () => {
await expect(
new DockerComposeEnvironment(fixtures, "docker-compose-with-healthcheck-with-start-period.yml")
.withWaitStrategy(await composeContainerName("container"), Wait.forHealthCheck())
.withStartupTimeout(0)
.up()
).rejects.toThrow(`Health check not healthy after 0ms`);

expect(await getRunningContainerNames()).not.toContain("container_1");
});

it("should remove volumes when downing an environment", async () => {
const environment = await new DockerComposeEnvironment(fixtures, "docker-compose-with-volume.yml").up();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ describe("HealthCheckWaitStrategy", { timeout: 180_000 }, () => {
.withName(containerName)
.withExposedPorts(8080)
.withWaitStrategy(Wait.forHealthCheck())
.withHealthCheck({ test: ["CMD-SHELL", "sleep 10"], timeout: 10_000 })
.withStartupTimeout(0)
.start()
).rejects.toThrowError("Health check not healthy after 0ms");
Expand Down