-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Explicit inclusion of `/run/wrappers/bin/` in $PATH appears unnecessary and causes default $PATH to be dropped, which includes `${pkgs.systemd}/bin`, which includes `systemd-run`, which podman uses to run health check commands. https://github.com/containers/podman/blob/0f04ba87bb7b2bdb20fe67705db6e428fd3dcdac/libpod/healthcheck_linux.go#L56
- Loading branch information
Showing
4 changed files
with
44 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
testConfig = { pkgs, ... }: { | ||
virtualisation.quadlet = { | ||
containers.good = { | ||
containerConfig = { | ||
image = "docker-archive:${pkgs.dockerTools.examples.redis}"; | ||
healthCmd = "redis-cli ping || exit 1"; | ||
healthRetries = 1; | ||
}; | ||
serviceConfig.TimeoutStartSec = 60; | ||
}; | ||
containers.bad = { | ||
containerConfig = { | ||
image = "docker-archive:${pkgs.dockerTools.examples.nginx}"; | ||
healthCmd = "exit 1"; | ||
healthRetries = 1; | ||
}; | ||
serviceConfig.TimeoutStartSec = 60; | ||
}; | ||
}; | ||
}; | ||
|
||
testScript = '' | ||
import time | ||
machine.wait_for_unit("default.target") | ||
machine.wait_for_unit("default.target", user=user) | ||
time.sleep(2) # wait for health command cycles | ||
containers = list_containers(user=user) | ||
assert len(containers) == 2 | ||
containers_by_name = { | ||
name: c | ||
for c in containers | ||
for name in c["Names"] | ||
} | ||
assert len(containers_by_name) == 2 | ||
assert "(healthy)" in containers_by_name["good"]["Status"] | ||
assert "(unhealthy)" in containers_by_name["bad"]["Status"] | ||
''; | ||
} |