Skip to content

Commit

Permalink
Merge pull request #21356 from edsantiago/new_testimages
Browse files Browse the repository at this point in the history
new testimage and systemd-image
  • Loading branch information
openshift-merge-bot[bot] authored Feb 9, 2024
2 parents 356102b + dbfa201 commit 4b1f0b0
Show file tree
Hide file tree
Showing 15 changed files with 109 additions and 145 deletions.
4 changes: 2 additions & 2 deletions test/apiv2/10-images.at
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/apiv2/20-containers.at
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
22 changes: 11 additions & 11 deletions test/e2e/config_amd64.go
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
)
4 changes: 2 additions & 2 deletions test/e2e/config_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
2 changes: 1 addition & 1 deletion test/e2e/config_ppc64le.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
2 changes: 1 addition & 1 deletion test/e2e/images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/rmi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
10 changes: 10 additions & 0 deletions test/system/125-import.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
74 changes: 30 additions & 44 deletions test/system/220-healthcheck.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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}}"
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
}

Expand Down
16 changes: 6 additions & 10 deletions test/system/250-systemd.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -376,7 +373,6 @@ LISTEN_FDNAMES=listen_fdnames" | sort)

# stop systemd container
service_cleanup
run_podman rmi -f $img
}

@test "[email protected] template" {
Expand Down
26 changes: 16 additions & 10 deletions test/system/320-system-df.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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))]}"
Expand Down
5 changes: 2 additions & 3 deletions test/system/build-systemd-image
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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"]
Expand Down
25 changes: 23 additions & 2 deletions test/system/build-testimage
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,34 @@ cat >pause <<EOF
#
# Trivial little pause script, used in one of the pod tests
#
trap 'exit 0' SIGTERM
echo Confirmed: testimage pause invoked as \$0
while :; do
sleep 0.1
done
EOF
chmod 755 pause

# Add a health check
cat >healthcheck <<EOF
#!/bin/sh
if test -e /uh-oh || test -e /uh-oh-only-once; then
echo "Uh-oh on stdout!"
echo "Uh-oh on stderr!" >&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
Expand All @@ -73,9 +94,9 @@ chmod 755 pause
#
cat >Containerfile1 <<EOF
ARG REPO=please-override-repo
FROM docker.io/\${REPO}/alpine:3.16.2
FROM docker.io/\${REPO}/alpine:3.19.0
RUN apk add busybox-extras iproute2 socat
ADD testimage-id pause /home/podman/
ADD testimage-id healthcheck pause /home/podman/
RUN rm -f /var/cache/apk/*
EOF

Expand Down
Loading

0 comments on commit 4b1f0b0

Please sign in to comment.