mirror of
https://github.com/containers/podman.git
synced 2025-06-23 02:18:13 +08:00
systests: quadlet: fixes for RHEL8
Some quadlet tests are failing on RHEL8: test code was using journalctl to check output from containers. This fails on RHEL8, where default log driver is k8s-file. Solution: use 'podman logs' instead. To do so, we need to keep the containers alive (otherwise, quadlet seems to delete them on exit). Do so by running 'top -b' (batch); the currently-used 'top' was failing because not-a-tty. Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@ -16,7 +16,7 @@ function start_time() {
|
||||
function setup() {
|
||||
skip_if_remote "quadlet tests are meaningless over remote"
|
||||
skip_if_rootless_cgroupsv1 "Can't use --cgroups=split w/ CGv1 (issue 17456, wontfix)"
|
||||
skip_if_journald_unavailable "quadlet isn't really usable without journal"
|
||||
skip_if_journald_unavailable "Needed for RHEL. FIXME: we might be able to reenable a subset of tests."
|
||||
|
||||
test -x "$QUADLET" || die "Cannot run quadlet tests without executable \$QUADLET ($QUADLET)"
|
||||
|
||||
@ -640,16 +640,14 @@ EOF
|
||||
cat > $quadlet_file <<EOF
|
||||
[Container]
|
||||
Rootfs=/:O
|
||||
Exec=sh -c "echo STARTED CONTAINER; echo "READY=1" | socat -u STDIN unix-sendto:\$NOTIFY_SOCKET; top"
|
||||
Exec=sh -c "echo STARTED CONTAINER; echo "READY=1" | socat -u STDIN unix-sendto:\$NOTIFY_SOCKET; top -b"
|
||||
Notify=yes
|
||||
EOF
|
||||
|
||||
run_quadlet "$quadlet_file"
|
||||
service_setup $QUADLET_SERVICE_NAME
|
||||
|
||||
# Ensure we have output. Output is synced via sd-notify (socat in Exec)
|
||||
run journalctl "--since=$STARTED_TIME" --unit="$QUADLET_SERVICE_NAME"
|
||||
is "$output" '.*STARTED CONTAINER.*'
|
||||
wait_for_output "STARTED CONTAINER" $QUADLET_CONTAINER_NAME
|
||||
}
|
||||
|
||||
@test "quadlet - selinux disable" {
|
||||
@ -659,15 +657,14 @@ EOF
|
||||
[Container]
|
||||
Image=$IMAGE
|
||||
SecurityLabelDisable=true
|
||||
Exec=sh -c "echo STARTED CONTAINER; top"
|
||||
Exec=sh -c "echo STARTED CONTAINER; top -b"
|
||||
EOF
|
||||
|
||||
run_quadlet "$quadlet_file"
|
||||
service_setup $QUADLET_SERVICE_NAME
|
||||
|
||||
# Ensure we have output. Output is synced via sd-notify (socat in Exec)
|
||||
run journalctl "--since=$STARTED_TIME" --unit="$QUADLET_SERVICE_NAME"
|
||||
is "$output" '.*STARTED CONTAINER.*'
|
||||
wait_for_output "STARTED CONTAINER" $QUADLET_CONTAINER_NAME
|
||||
|
||||
run_podman container inspect --format "{{.ProcessLabel}}" $QUADLET_CONTAINER_NAME
|
||||
is "$output" "" "container should be started without specifying a Process Label"
|
||||
@ -686,15 +683,14 @@ Image=$IMAGE
|
||||
SecurityLabelType=spc_t
|
||||
SecurityLabelLevel=s0:c100,c200
|
||||
SecurityLabelFileType=container_ro_file_t
|
||||
Exec=sh -c "echo STARTED CONTAINER; top"
|
||||
Exec=sh -c "echo STARTED CONTAINER; top -b"
|
||||
EOF
|
||||
|
||||
run_quadlet "$quadlet_file"
|
||||
service_setup $QUADLET_SERVICE_NAME
|
||||
|
||||
# Ensure we have output. Output is synced via sd-notify (socat in Exec)
|
||||
run journalctl "--since=$STARTED_TIME" --unit="$QUADLET_SERVICE_NAME"
|
||||
is "$output" '.*STARTED CONTAINER.*'
|
||||
wait_for_output "STARTED CONTAINER" $NAME
|
||||
|
||||
run_podman container ps
|
||||
run_podman container inspect --format "{{.ProcessLabel}}" $NAME
|
||||
@ -714,7 +710,7 @@ EOF
|
||||
ContainerName=$NAME
|
||||
Image=$IMAGE
|
||||
Secret=$SECRET_NAME,type=env,target=MYSECRET
|
||||
Exec=sh -c "echo STARTED CONTAINER; echo "READY=1" | socat -u STDIN unix-sendto:\$NOTIFY_SOCKET; top"
|
||||
Exec=sh -c "echo STARTED CONTAINER; echo "READY=1" | socat -u STDIN unix-sendto:\$NOTIFY_SOCKET; top -b"
|
||||
Notify=yes
|
||||
EOF
|
||||
|
||||
@ -722,8 +718,7 @@ EOF
|
||||
service_setup $QUADLET_SERVICE_NAME
|
||||
|
||||
# Ensure we have output. Output is synced via sd-notify (socat in Exec)
|
||||
run journalctl "--since=$STARTED_TIME" --unit="$QUADLET_SERVICE_NAME"
|
||||
is "$output" '.*STARTED CONTAINER.*'
|
||||
wait_for_output "STARTED CONTAINER" $QUADLET_CONTAINER_NAME
|
||||
|
||||
run_podman exec $QUADLET_CONTAINER_NAME /bin/sh -c "printenv MYSECRET"
|
||||
is "$output" $SECRET
|
||||
@ -741,7 +736,7 @@ EOF
|
||||
ContainerName=$NAME
|
||||
Image=$IMAGE
|
||||
Secret=$SECRET_NAME,type=mount,target=/root/secret
|
||||
Exec=sh -c "echo STARTED CONTAINER; echo "READY=1" | socat -u STDIN unix-sendto:\$NOTIFY_SOCKET; top"
|
||||
Exec=sh -c "echo STARTED CONTAINER; echo "READY=1" | socat -u STDIN unix-sendto:\$NOTIFY_SOCKET; top -b"
|
||||
Notify=yes
|
||||
EOF
|
||||
|
||||
@ -749,8 +744,7 @@ EOF
|
||||
service_setup $QUADLET_SERVICE_NAME
|
||||
|
||||
# Ensure we have output. Output is synced via sd-notify (socat in Exec)
|
||||
run journalctl "--since=$STARTED_TIME" --unit="$QUADLET_SERVICE_NAME"
|
||||
is "$output" '.*STARTED CONTAINER.*'
|
||||
wait_for_output "STARTED CONTAINER" $QUADLET_CONTAINER_NAME
|
||||
|
||||
run_podman exec $QUADLET_CONTAINER_NAME /bin/sh -c "cat /root/secret"
|
||||
is "$output" $SECRET
|
||||
|
Reference in New Issue
Block a user