CI: Quadlet rootfs test: use container image as rootfs

Test was written to use / (root). This is not parallel-safe.

Fixes: #23909

Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
Ed Santiago 2024-09-19 05:43:35 -06:00
parent 217ecac740
commit a08ae98161
1 changed files with 14 additions and 1 deletions

View File

@ -723,10 +723,18 @@ EOF
@test "quadlet - rootfs" { @test "quadlet - rootfs" {
skip_if_no_selinux skip_if_no_selinux
skip_if_rootless skip_if_rootless
# Mount a container image to use as rootfs. Because we (may) run in
# parallel, mount a working container, not $IMAGE
cname="c-$(safename)"
run_podman run -d --name $cname $IMAGE top
run_podman container mount $cname
mountpoint="$output"
local quadlet_file=$PODMAN_TMPDIR/basic_$(safename).container local quadlet_file=$PODMAN_TMPDIR/basic_$(safename).container
cat > $quadlet_file <<EOF cat > $quadlet_file <<EOF
[Container] [Container]
Rootfs=/:O Rootfs=$mountpoint:O
Exec=sh -c "echo STARTED CONTAINER; echo "READY=1" | socat -u STDIN unix-sendto:\$NOTIFY_SOCKET; top -b" Exec=sh -c "echo STARTED CONTAINER; echo "READY=1" | socat -u STDIN unix-sendto:\$NOTIFY_SOCKET; top -b"
Notify=yes Notify=yes
EOF EOF
@ -735,6 +743,11 @@ EOF
service_setup $QUADLET_SERVICE_NAME service_setup $QUADLET_SERVICE_NAME
wait_for_output "STARTED CONTAINER" $QUADLET_CONTAINER_NAME wait_for_output "STARTED CONTAINER" $QUADLET_CONTAINER_NAME
# Done. Clean up.
service_cleanup $QUADLET_SERVICE_NAME failed
run_podman container unmount $cname
run_podman rm -f -t0 $cname
} }
@test "quadlet - selinux disable" { @test "quadlet - selinux disable" {