-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new testimage and systemd-image #21356
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
package integration | ||
|
||
var ( | ||
STORAGE_FS = "overlay" //nolint:revive,stylecheck | ||
STORAGE_OPTIONS = "--storage-driver overlay" //nolint:revive,stylecheck | ||
ROOTLESS_STORAGE_FS = "overlay" //nolint:revive,stylecheck | ||
ROOTLESS_STORAGE_OPTIONS = "--storage-driver overlay" //nolint:revive,stylecheck | ||
CACHE_IMAGES = []string{ALPINE, BB, fedoraMinimal, NGINX_IMAGE, REDIS_IMAGE, REGISTRY_IMAGE, INFRA_IMAGE, CITEST_IMAGE, HEALTHCHECK_IMAGE, SYSTEMD_IMAGE, fedoraToolbox} //nolint:revive,stylecheck | ||
NGINX_IMAGE = "quay.io/libpod/alpine_nginx:latest" //nolint:revive,stylecheck | ||
BB_GLIBC = "docker.io/library/busybox:glibc" //nolint:revive,stylecheck | ||
REGISTRY_IMAGE = "quay.io/libpod/registry:2.8.2" //nolint:revive,stylecheck | ||
CITEST_IMAGE = "quay.io/libpod/testimage:20221018" //nolint:revive,stylecheck | ||
SYSTEMD_IMAGE = "quay.io/libpod/systemd-image:20230106" //nolint:revive,stylecheck | ||
CIRROS_IMAGE = "quay.io/libpod/cirros:latest" //nolint:revive,stylecheck | ||
STORAGE_FS = "overlay" //nolint:revive,stylecheck | ||
STORAGE_OPTIONS = "--storage-driver overlay" //nolint:revive,stylecheck | ||
ROOTLESS_STORAGE_FS = "overlay" //nolint:revive,stylecheck | ||
ROOTLESS_STORAGE_OPTIONS = "--storage-driver overlay" //nolint:revive,stylecheck | ||
CACHE_IMAGES = []string{ALPINE, BB, NGINX_IMAGE, REDIS_IMAGE, REGISTRY_IMAGE, INFRA_IMAGE, CITEST_IMAGE, HEALTHCHECK_IMAGE, SYSTEMD_IMAGE, fedoraToolbox} //nolint:revive,stylecheck | ||
NGINX_IMAGE = "quay.io/libpod/alpine_nginx:latest" //nolint:revive,stylecheck | ||
BB_GLIBC = "docker.io/library/busybox:glibc" //nolint:revive,stylecheck | ||
REGISTRY_IMAGE = "quay.io/libpod/registry:2.8.2" //nolint:revive,stylecheck | ||
CITEST_IMAGE = "quay.io/libpod/testimage:20240123" //nolint:revive,stylecheck | ||
SYSTEMD_IMAGE = "quay.io/libpod/systemd-image:20240124" //nolint:revive,stylecheck | ||
CIRROS_IMAGE = "quay.io/libpod/cirros:latest" //nolint:revive,stylecheck | ||
) |
Original file line number | Diff line number | Diff line change | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -33,15 +33,12 @@ function _check_health { | ||||||||||
} | |||||||||||
|
|||||||||||
@test "podman healthcheck" { | |||||||||||
_build_health_check_image healthcheck_i | |||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, hivemind, here's a stumper:
Time, in seconds, for
Results are consistent across O(10) runs. Very low priority, this is a just-curious question: any ideas? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rootless vs root would be different systemd daemons (the user instance vs actual PID1 systemd) which could account for some of this? I assume user instance is less busy. |
|||||||||||
|
|||||||||||
# Run that healthcheck image. | |||||||||||
run_podman run -d --name healthcheck_c \ | |||||||||||
--health-cmd /healthcheck \ | |||||||||||
--health-interval 1s \ | |||||||||||
--health-retries 3 \ | |||||||||||
--health-on-failure=kill \ | |||||||||||
healthcheck_i | |||||||||||
run_podman run -d --name healthcheck_c \ | |||||||||||
--health-cmd /home/podman/healthcheck \ | |||||||||||
--health-interval 1s \ | |||||||||||
--health-retries 3 \ | |||||||||||
--health-on-failure=kill \ | |||||||||||
$IMAGE /home/podman/pause | |||||||||||
|
|||||||||||
run_podman inspect healthcheck_c --format "{{.Config.HealthcheckOnFailureAction}}" | |||||||||||
is "$output" "kill" "on-failure action is set to kill" | |||||||||||
|
@@ -88,25 +85,22 @@ Log[-1].Output | \"Uh-oh on stdout!\\\nUh-oh on stderr!\" | ||||||||||
|
|||||||||||
# Clean up | |||||||||||
run_podman rm -t 0 -f healthcheck_c | |||||||||||
run_podman rmi healthcheck_i | |||||||||||
} | |||||||||||
|
|||||||||||
@test "podman healthcheck - restart cleans up old state" { | |||||||||||
ctr="healthcheck_c" | |||||||||||
img="healthcheck_i" | |||||||||||
|
|||||||||||
_build_health_check_image $img cleanfile | |||||||||||
run_podman run -d --name $ctr \ | |||||||||||
--health-cmd /healthcheck \ | |||||||||||
--health-retries=3 \ | |||||||||||
--health-interval=disable \ | |||||||||||
$img | |||||||||||
run_podman run -d --name $ctr \ | |||||||||||
--health-cmd /home/podman/healthcheck \ | |||||||||||
--health-retries=3 \ | |||||||||||
--health-interval=disable \ | |||||||||||
$IMAGE /home/podman/pause | |||||||||||
|
|||||||||||
run_podman container inspect $ctr --format "{{.State.Healthcheck.FailingStreak}}" | |||||||||||
is "$output" "0" "Failing streak of fresh container should be 0" | |||||||||||
|
|||||||||||
# Get the healthcheck to fail | |||||||||||
run_podman exec $ctr touch /uh-oh | |||||||||||
run_podman exec $ctr touch /uh-oh-only-once | |||||||||||
run_podman 1 healthcheck run $ctr | |||||||||||
is "$output" "unhealthy" "output from 'podman healthcheck run'" | |||||||||||
run_podman container inspect $ctr --format "{{.State.Healthcheck.FailingStreak}}" | |||||||||||
|
@@ -117,22 +111,20 @@ Log[-1].Output | \"Uh-oh on stdout!\\\nUh-oh on stderr!\" | ||||||||||
is "$output" "0" "Failing streak of restarted container should be 0 again" | |||||||||||
|
|||||||||||
run_podman rm -f -t0 $ctr | |||||||||||
run_podman rmi $img | |||||||||||
} | |||||||||||
|
|||||||||||
@test "podman wait --condition={healthy,unhealthy}" { | |||||||||||
ctr="healthcheck_c" | |||||||||||
img="healthcheck_i" | |||||||||||
|
|||||||||||
wait_file="$PODMAN_TMPDIR/$(random_string).wait_for_me" | |||||||||||
_build_health_check_image $img | |||||||||||
|
|||||||||||
for condition in healthy unhealthy;do | |||||||||||
rm -f $wait_file | |||||||||||
run_podman run -d --name $ctr \ | |||||||||||
--health-cmd /healthcheck \ | |||||||||||
--health-retries=1 \ | |||||||||||
--health-interval=disable \ | |||||||||||
$img | |||||||||||
run_podman run -d --name $ctr \ | |||||||||||
--health-cmd /home/podman/healthcheck \ | |||||||||||
--health-retries=1 \ | |||||||||||
--health-interval=disable \ | |||||||||||
$IMAGE /home/podman/pause | |||||||||||
if [[ $condition == "unhealthy" ]];then | |||||||||||
# create the uh-oh file to let the health check fail | |||||||||||
run_podman exec $ctr touch /uh-oh | |||||||||||
|
@@ -156,39 +148,34 @@ Log[-1].Output | \"Uh-oh on stdout!\\\nUh-oh on stderr!\" | ||||||||||
wait_for_file $wait_file | |||||||||||
run_podman rm -f -t0 $ctr | |||||||||||
done | |||||||||||
|
|||||||||||
run_podman rmi $img | |||||||||||
} | |||||||||||
|
|||||||||||
@test "podman healthcheck --health-on-failure" { | |||||||||||
run_podman 125 create --health-on-failure=kill $IMAGE | |||||||||||
is "$output" "Error: cannot set on-failure action to kill without a health check" | |||||||||||
|
|||||||||||
ctr="healthcheck_c" | |||||||||||
img="healthcheck_i" | |||||||||||
|
|||||||||||
for policy in none kill restart stop;do | |||||||||||
if [[ $policy == "none" ]];then | |||||||||||
# Do not remove the /uh-oh file for `none` as we want to | |||||||||||
# demonstrate that no action was taken | |||||||||||
_build_health_check_image $img | |||||||||||
else | |||||||||||
_build_health_check_image $img cleanfile | |||||||||||
uhoh=/uh-oh | |||||||||||
if [[ $policy != "none" ]];then | |||||||||||
# only fail the first run | |||||||||||
uhoh=/uh-oh-only-once | |||||||||||
fi | |||||||||||
|
|||||||||||
# Run that healthcheck image. | |||||||||||
run_podman run -d --name $ctr \ | |||||||||||
--health-cmd /healthcheck \ | |||||||||||
--health-retries=1 \ | |||||||||||
--health-on-failure=$policy \ | |||||||||||
--health-interval=disable \ | |||||||||||
$img | |||||||||||
# Run healthcheck image. | |||||||||||
run_podman run -d --name $ctr \ | |||||||||||
--health-cmd /home/podman/healthcheck \ | |||||||||||
--health-retries=1 \ | |||||||||||
--health-on-failure=$policy \ | |||||||||||
--health-interval=disable \ | |||||||||||
$IMAGE /home/podman/pause | |||||||||||
|
|||||||||||
# healthcheck should succeed | |||||||||||
run_podman healthcheck run $ctr | |||||||||||
|
|||||||||||
# Now cause the healthcheck to fail | |||||||||||
run_podman exec $ctr touch /uh-oh | |||||||||||
run_podman exec $ctr touch $uhoh | |||||||||||
|
|||||||||||
# healthcheck should now fail, with exit status 1 and 'unhealthy' output | |||||||||||
run_podman 1 healthcheck run $ctr | |||||||||||
|
@@ -218,7 +205,6 @@ Log[-1].Output | \"Uh-oh on stdout!\\\nUh-oh on stderr!\" | ||||||||||
fi | |||||||||||
|
|||||||||||
run_podman rm -f -t0 $ctr | |||||||||||
run_podman rmi -f $img | |||||||||||
done | |||||||||||
} | |||||||||||
|
|||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -324,16 +324,13 @@ LISTEN_FDNAMES=listen_fdnames" | sort) | |
} | ||
|
||
@test "podman create --health-on-failure=kill" { | ||
img="healthcheck_i" | ||
_build_health_check_image $img | ||
|
||
cname=c_$(random_string) | ||
run_podman create --name $cname \ | ||
--health-cmd /healthcheck \ | ||
--health-on-failure=kill \ | ||
--health-retries=1 \ | ||
--restart=on-failure \ | ||
$img | ||
run_podman create --name $cname \ | ||
--health-cmd /home/podman/healthcheck \ | ||
--health-on-failure=kill \ | ||
--health-retries=1 \ | ||
--restart=on-failure \ | ||
$IMAGE /home/podman/pause | ||
|
||
# run container in systemd unit | ||
service_setup | ||
|
@@ -376,7 +373,6 @@ LISTEN_FDNAMES=listen_fdnames" | sort) | |
|
||
# stop systemd container | ||
service_cleanup | ||
run_podman rmi -f $img | ||
} | ||
|
||
@test "[email protected] template" { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,11 +31,10 @@ cd $tmpdir | |
echo $YMD >testimage-id | ||
|
||
cat >Containerfile <<EOF | ||
FROM registry.fedoraproject.org/fedora-minimal:38 | ||
FROM registry.fedoraproject.org/fedora-minimal:39 | ||
LABEL created_by="$create_script @ $create_script_rev" | ||
LABEL created_at=$create_time_z | ||
# Note the reinstall of tzdata is required (https://bugzilla.redhat.com/show_bug.cgi?id=1870814) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See the BZ for details. TL;DR tzdata is no longer in fedora-minimal at all. |
||
RUN microdnf install -y systemd && microdnf reinstall -y tzdata && microdnf clean all && sed -i -e 's/.*LogColor.*/LogColor=no/' /etc/systemd/system.conf | ||
RUN microdnf install -y systemd tzdata && microdnf clean all && sed -i -e 's/.*LogColor.*/LogColor=no/' /etc/systemd/system.conf | ||
ADD testimage-id /home/podman/ | ||
WORKDIR /home/podman | ||
CMD ["/bin/echo", "This image is intended for podman CI testing"] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future: is there a good reason for duplicatingly defining
CITEST_IMAGE
and others inconfig_TAGGED.go
instead of justconfig.go
? Maybe historically these were different? I am absolutely not going to change that in this already-too-big PR, but I'd like to consider doing so in a followup.