From dbfa201c9a8839794b2fe1f5f81c5d8b5f3a07d1 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Wed, 24 Jan 2024 07:28:45 -0700 Subject: [PATCH] new testimage and systemd-image Simply because it's been a while since the last testimage build, and I want to confirm that our image build process still works. Added /home/podman/healthcheck. This saves us having to podman-build on each healthcheck test. Removed now- unneeded _build_health_check_image helper. testimage: bump alpine 3.16.2 to 3.19.0 systemd-image: f38 to f39 - tzdata now requires dnf **install**, not reinstall (this is exactly the sort of thing I was looking for) PROBLEMS DISCOVERED: - in e2e, fedoraMinimal is now == SYSTEMD_IMAGE. This screws up some of the image-count tests (CACHE_IMAGES). - "alter tarball" system test now barfs with tar < 1.35. TODO: completely replace fedoraMinimal with SYSTEMD_IMAGE in all tests. Signed-off-by: Ed Santiago --- test/apiv2/10-images.at | 4 +- test/apiv2/20-containers.at | 2 +- test/e2e/config.go | 2 +- test/e2e/config_amd64.go | 22 +++++----- test/e2e/config_arm64.go | 4 +- test/e2e/config_ppc64le.go | 2 +- test/e2e/images_test.go | 2 +- test/e2e/rmi_test.go | 2 +- test/system/125-import.bats | 10 +++++ test/system/220-healthcheck.bats | 74 +++++++++++++------------------- test/system/250-systemd.bats | 16 +++---- test/system/320-system-df.bats | 26 ++++++----- test/system/build-systemd-image | 5 +-- test/system/build-testimage | 25 ++++++++++- test/system/helpers.bash | 58 +------------------------ 15 files changed, 109 insertions(+), 145 deletions(-) diff --git a/test/apiv2/10-images.at b/test/apiv2/10-images.at index 2c1f734c9e..06bee6cffb 100644 --- a/test/apiv2/10-images.at +++ b/test/apiv2/10-images.at @@ -54,8 +54,8 @@ t POST "libpod/images/pull?reference=alpine&compatMode=true" 200 .error~null .st t POST "images/create?fromImage=alpine&tag=latest" 200 # 10977 - handle platform parameter correctly -t POST "images/create?fromImage=quay.io/libpod/testimage:20210610&platform=linux/arm64" 200 -t GET "images/testimage:20210610/json" 200 \ +t POST "images/create?fromImage=quay.io/libpod/testimage:20240123&platform=linux/arm64" 200 +t GET "images/testimage:20240123/json" 200 \ .Architecture=arm64 # Make sure that new images are pulled diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at index 770adecd73..009d12fa25 100644 --- a/test/apiv2/20-containers.at +++ b/test/apiv2/20-containers.at @@ -4,7 +4,7 @@ # # WORKDIR=/data -ENV_WORKDIR_IMG=quay.io/libpod/testimage:20200929 +ENV_WORKDIR_IMG=quay.io/libpod/testimage:20240123 MultiTagName=localhost/test/testformultitag:tag podman pull $IMAGE &>/dev/null diff --git a/test/e2e/config.go b/test/e2e/config.go index b70901326f..3ab956dd9a 100644 --- a/test/e2e/config.go +++ b/test/e2e/config.go @@ -2,7 +2,7 @@ package integration var ( REDIS_IMAGE = "quay.io/libpod/redis:alpine" //nolint:revive,stylecheck - fedoraMinimal = "quay.io/libpod/systemd-image:20230531" + fedoraMinimal = "quay.io/libpod/systemd-image:20240124" ALPINE = "quay.io/libpod/alpine:latest" ALPINELISTTAG = "quay.io/libpod/alpine:3.10.2" ALPINELISTDIGEST = "quay.io/libpod/alpine@sha256:fa93b01658e3a5a1686dc3ae55f170d8de487006fb53a28efcd12ab0710a2e5f" diff --git a/test/e2e/config_amd64.go b/test/e2e/config_amd64.go index 248a1a9f00..1ef7ec4aa3 100644 --- a/test/e2e/config_amd64.go +++ b/test/e2e/config_amd64.go @@ -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 ) diff --git a/test/e2e/config_arm64.go b/test/e2e/config_arm64.go index 952cee9e43..9ace0fc41f 100644 --- a/test/e2e/config_arm64.go +++ b/test/e2e/config_arm64.go @@ -9,7 +9,7 @@ var ( NGINX_IMAGE = "quay.io/lsm5/alpine_nginx-aarch64: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 + 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 ) diff --git a/test/e2e/config_ppc64le.go b/test/e2e/config_ppc64le.go index 4b708ce1e4..2a294a9ee7 100644 --- a/test/e2e/config_ppc64le.go +++ b/test/e2e/config_ppc64le.go @@ -8,6 +8,6 @@ var ( CACHE_IMAGES = []string{ALPINE, BB, fedoraMinimal, NGINX_IMAGE, REDIS_IMAGE, INFRA_IMAGE, CITEST_IMAGE} NGINX_IMAGE = "quay.io/libpod/alpine_nginx-ppc64le:latest" BB_GLIBC = "docker.io/ppc64le/busybox:glibc" - CITEST_IMAGE = "quay.io/libpod/testimage:20221018" + CITEST_IMAGE = "quay.io/libpod/testimage:20240123" REGISTRY_IMAGE string ) diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go index 6d7f45fe59..63a029f197 100644 --- a/test/e2e/images_test.go +++ b/test/e2e/images_test.go @@ -148,7 +148,7 @@ var _ = Describe("Podman images", func() { result := podmanTest.Podman([]string{"images", "-q", "-f", "reference=quay.io/libpod/*"}) result.WaitWithDefaultTimeout() Expect(result).Should(ExitCleanly()) - Expect(result.OutputToStringArray()).To(HaveLen(10)) + Expect(result.OutputToStringArray()).To(HaveLen(9)) retalpine := podmanTest.Podman([]string{"images", "-f", "reference=*lpine*"}) retalpine.WaitWithDefaultTimeout() diff --git a/test/e2e/rmi_test.go b/test/e2e/rmi_test.go index 0b3f9e28b5..5caec5f6da 100644 --- a/test/e2e/rmi_test.go +++ b/test/e2e/rmi_test.go @@ -214,7 +214,7 @@ var _ = Describe("Podman rmi", func() { session = podmanTest.Podman([]string{"images", "-q", "-a"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - Expect(session.OutputToString()).To(HaveLen(142)) + Expect(session.OutputToStringArray()).To(HaveLen(len(CACHE_IMAGES))) }) It("podman rmi -a with no images should be exit 0", func() { diff --git a/test/system/125-import.bats b/test/system/125-import.bats index 91c0b554f3..5f2f2c64a8 100644 --- a/test/system/125-import.bats +++ b/test/system/125-import.bats @@ -47,6 +47,14 @@ load helpers # Integration tag to catch future breakage in tar, e.g. #19407 # bats test_tags=distro-integration @test "podman export, alter tarball, re-import" { + # FIXME: #21373 - tar < 1.35 is broken. + # Remove this skip once all VMs are updated to 1.35.2 or above + # (.2, because of #19407) + tar_version=$(tar --version | head -1 | awk '{print $NF}' | tr -d .) + if [[ $tar_version -lt 135 ]]; then + skip "test requires tar >= 1.35 (you have: $tar_version)" + fi + # Create a test file following test mkdir $PODMAN_TMPDIR/tmp touch $PODMAN_TMPDIR/testfile1 @@ -75,7 +83,9 @@ EOF run_podman rm -t 0 -f $b_cnt # Modify tarball contents + echo "$_LOG_PROMPT tar --delete -f (tmpdir)/$b_cnt.tar tmp/testfile1" tar --delete -f $PODMAN_TMPDIR/$b_cnt.tar tmp/testfile1 + echo "$_LOG_PROMPT tar -C (tmpdir) -rf (tmpdir)/$b_cnt.tar tmp/testfile2" tar -C $PODMAN_TMPDIR -rf $PODMAN_TMPDIR/$b_cnt.tar tmp/testfile2 # Import tarball and Tag imported image diff --git a/test/system/220-healthcheck.bats b/test/system/220-healthcheck.bats index f6224ca1e2..c5f0f0ac2c 100644 --- a/test/system/220-healthcheck.bats +++ b/test/system/220-healthcheck.bats @@ -33,15 +33,12 @@ function _check_health { } @test "podman healthcheck" { - _build_health_check_image healthcheck_i - - # 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,8 +148,6 @@ 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" { @@ -165,30 +155,27 @@ Log[-1].Output | \"Uh-oh on stdout!\\\nUh-oh on stderr!\" 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 } diff --git a/test/system/250-systemd.bats b/test/system/250-systemd.bats index 0e6a1ba3a8..1d590224f8 100644 --- a/test/system/250-systemd.bats +++ b/test/system/250-systemd.bats @@ -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 "podman-kube@.service template" { diff --git a/test/system/320-system-df.bats b/test/system/320-system-df.bats index 1084d25fcd..96219074b3 100644 --- a/test/system/320-system-df.bats +++ b/test/system/320-system-df.bats @@ -45,22 +45,28 @@ function teardown() { run_podman system df --format json local results="$output" + # FIXME! This needs to be fiddled with every time we bump testimage. + local size=11 + if [[ "$(uname -m)" = "aarch64" ]]; then + size=13 + fi + # FIXME: we can't check exact RawSize or Size because every CI system # computes a different value: 12701526, 12702113, 12706209... and # those are all amd64. aarch64 gets 12020148, 12019561. # # WARNING: RawSize and Size tests may fail if $IMAGE is updated. Since # that tends to be done yearly or less, and only by Ed, that's OK. - local tests=' -Type | Images | Containers | Local Volumes -Total | 1 | 2 | 0 -Active | 1 | 1 | 0 -RawSize | ~12...... | !0 | 0 -RawReclaimable | 0 | !0 | 0 -Reclaimable | ~\(0%\) | ~\(50%\) | ~\(0%\) -TotalCount | 1 | 2 | 0 -Size | ~12.*MB | !0B | 0B -' + local tests=" +Type | Images | Containers | Local Volumes +Total | 1 | 2 | 0 +Active | 1 | 1 | 0 +RawSize | ~${size}...... | !0 | 0 +RawReclaimable | 0 | !0 | 0 +Reclaimable | ~\(0%\) | ~\(50%\) | ~\(0%\) +TotalCount | 1 | 2 | 0 +Size | ~${size}.*MB | !0B | 0B +" while read -a fields; do for i in 0 1 2;do expect="${fields[$((i+1))]}" diff --git a/test/system/build-systemd-image b/test/system/build-systemd-image index 724340a80f..aa018e6677 100755 --- a/test/system/build-systemd-image +++ b/test/system/build-systemd-image @@ -31,11 +31,10 @@ cd $tmpdir echo $YMD >testimage-id cat >Containerfile <pause <healthcheck <&2 + + # Special file causes us to fail healthcheck only once + rm -f /uh-oh-only-once + + exit 1 +else + echo "Life is Good on stdout" + echo "Life is Good on stderr" >&2 + exit 0 +fi +EOF +chmod 755 healthcheck + # alpine because it's small and light and reliable # - check for updates @ https://hub.docker.com/_/alpine # busybox-extras provides httpd needed in 500-networking.bats @@ -73,9 +94,9 @@ chmod 755 pause # cat >Containerfile1 <${PODMAN_TMPDIR}/healthcheck <&2 - ${cleanfile} - exit 1 -else - echo "Life is Good on stdout" - echo "Life is Good on stderr" >&2 - exit 0 -fi -EOF - - cat >${PODMAN_TMPDIR}/entrypoint <${PODMAN_TMPDIR}/Containerfile <