diff --git a/test/system/030-run.bats b/test/system/030-run.bats index bb12bf6826..5ff1fb29ba 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -127,10 +127,7 @@ echo $rand | 0 | $rand @test "podman run --name" { randomname=$(random_string 30) - # Assume that 4 seconds gives us enough time for 3 quick tests (or at - # least for the 'ps'; the 'container exists' should pass even in the - # unlikely case that the container exits before we get to them) - run_podman run -d --name $randomname $IMAGE sleep 4 + run_podman run -d --name $randomname $IMAGE sleep inf cid=$output run_podman ps --format '{{.Names}}--{{.ID}}' @@ -140,7 +137,7 @@ echo $rand | 0 | $rand run_podman container exists $cid # Done with live-container tests; now let's test after container finishes - run_podman wait $cid + run_podman stop -t0 $cid # Container still exists even after stopping: run_podman container exists $randomname @@ -1143,16 +1140,19 @@ EOF CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman 1 run --rm $IMAGE touch /testro CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm --read-only=false $IMAGE touch /testrw - CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm $IMAGE touch /tmp/testrw - for dir in /tmp /var/tmp /dev /dev/shm /run; do - CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm $IMAGE touch $dir/testro - CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm --read-only=false $IMAGE touch $dir/testro - CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm --read-only=false --read-only-tmpfs=true $IMAGE touch $dir/testro - CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm --read-only-tmpfs=true $IMAGE touch $dir/testro - CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman 1 run --rm --read-only-tmpfs=false $IMAGE touch $dir/testro - assert "$output" =~ "touch: $dir/testro: Read-only file system" - done + files="/tmp/a /var/tmp/b /dev/c /dev/shm/d /run/e" + CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm $IMAGE touch $files + CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm --read-only=false $IMAGE touch $files + CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm --read-only=false --read-only-tmpfs=true $IMAGE touch $files + CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm --read-only-tmpfs=true $IMAGE touch $files + + CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman 1 run --rm --read-only-tmpfs=false $IMAGE touch $files + assert "$output" == "touch: /tmp/a: Read-only file system +touch: /var/tmp/b: Read-only file system +touch: /dev/c: Read-only file system +touch: /dev/shm/d: Read-only file system +touch: /run/e: Read-only file system" } @test "podman run ulimit from containers.conf" { diff --git a/test/system/035-logs.bats b/test/system/035-logs.bats index e0d80db689..6325b88e06 100644 --- a/test/system/035-logs.bats +++ b/test/system/035-logs.bats @@ -89,36 +89,30 @@ function _log_test_multi() { skip_if_remote "logs does not support multiple containers when run remotely" - # Under k8s file, 'podman logs' returns just the facts, Ma'am. - # Under journald, there may be other cruft (e.g. container removals) - local etc= - if [[ $driver =~ journal ]]; then - etc='.*' - fi - local events_backend=$(_additional_events_backend $driver) # Simple helper to make the container starts, below, easier to read local -a cid doit() { - run_podman ${events_backend} run --log-driver=$driver --rm -d --name "$1" $IMAGE sh -c "$2"; + run_podman ${events_backend} run --log-driver=$driver -d \ + --name "$1" $IMAGE sh -c "$2"; cid+=($(echo "${output:0:12}")) } - # Not really a guarantee that we'll get a-b-c-d in order, but it's - # the best we can do. The trailing 'sleep' in each container - # minimizes the chance of a race condition in which the container - # is removed before 'podman logs' has a chance to wake up and read - # the final output. - doit c1 "echo a;sleep 10;echo d;sleep 3" - doit c2 "sleep 1;echo b;sleep 2;echo c;sleep 3" + doit c1 "echo a1; echo a2" + doit c2 "echo b1; echo b2" + # Reading logs only guarantees the order for a single container, + # when using multiple containers the line order between them can vary. run_podman ${events_backend} logs -f c1 c2 assert "$output" =~ \ - "${cid[0]} a$etc -${cid[1]} b$etc -${cid[1]} c$etc -${cid[0]} d" "Sequential output from logs" + ".*^${cid[0]} a1\$.* +${cid[0]} a2" "Sequential output from c1" + assert "$output" =~ \ + ".*^${cid[1]} b1\$.* +${cid[1]} b2" "Sequential output from c2" + + run_podman rm -f -t0 ${cid[0]} ${cid[1]} } @test "podman logs - multi k8s-file" { diff --git a/test/system/040-ps.bats b/test/system/040-ps.bats index f9fc531fa2..5259299ecc 100644 --- a/test/system/040-ps.bats +++ b/test/system/040-ps.bats @@ -24,8 +24,8 @@ load helpers "${cid:0:12} \+$IMAGE \+sleep [0-9]\+ .*second.* $cname"\ "output from podman ps" - # OK. Wait for sleep to finish... - run_podman wait $cid + # OK. Stop container now. + run_podman stop -t0 $cid # ...then make sure container shows up as stopped run_podman ps -a diff --git a/test/system/055-rm.bats b/test/system/055-rm.bats index c8169746ec..cfd2adf009 100644 --- a/test/system/055-rm.bats +++ b/test/system/055-rm.bats @@ -124,10 +124,10 @@ function __run_healthcheck_container() { run_podman run -d --name $1 \ --health-cmd /bin/false \ --health-interval 1s \ - --health-retries 2 \ + --health-retries 1 \ --health-timeout 1s \ --health-on-failure=stop \ - --stop-timeout=2 \ + --stop-timeout=1 \ --health-start-period 0 \ --stop-signal SIGTERM \ $IMAGE sleep infinity @@ -156,7 +156,7 @@ function __run_healthcheck_container() { assert "$output" =~ "Error: cannot remove container $cid as it is .* - running or paused containers cannot be removed without force: container state improper" \ "Expected error message from podman rm" rm_failures=$((rm_failures + 1)) - sleep 1 + sleep 0.5 done # At this point, container should be gone diff --git a/test/system/130-kill.bats b/test/system/130-kill.bats index 013edc3d5c..c03a7e1121 100644 --- a/test/system/130-kill.bats +++ b/test/system/130-kill.bats @@ -7,35 +7,18 @@ load helpers # bats test_tags=distro-integration @test "podman kill - test signal handling in containers" { - - # Prepare for 'logs -f' - run_podman info --format '{{.Host.LogDriver}}' - log_driver=$output - run_podman info --format '{{.Host.EventLogger}}' - event_logger=$output - opt_log_driver= - if [ $log_driver = "journald" ] && [ $event_logger != "journald" ]; then - # Since PR#10431, 'logs -f' with journald driver is only supported with journald events backend. - # Set '--log driver' temporally because remote doesn't support '--events-backend'. - opt_log_driver="--log-driver k8s-file" - fi + local cname=c-$(random_string 10) + local fifo=${PODMAN_TMPDIR}/podman-kill-fifo.$(random_string 10) + mkfifo $fifo # Start a container that will handle all signals by emitting 'got: N' local -a signals=(1 2 3 4 5 6 8 10 12 13 14 15 16 20 21 22 23 24 25 26 64) - run_podman run -d ${opt_log_driver} $IMAGE sh -c \ + $PODMAN run --name $cname $IMAGE sh -c \ "for i in ${signals[*]}; do trap \"echo got: \$i\" \$i; done; echo READY; while ! test -e /stop; do sleep 0.1; done; - echo DONE" - cid="$output" - - # Run 'logs -f' on that container, but run it in the background with - # redirection to a named pipe from which we (foreground job) read - # and confirm that signals are received. We can't use run_podman here. - local fifo=${PODMAN_TMPDIR}/podman-kill-fifo.$(random_string 10) - mkfifo $fifo - $PODMAN logs -f $cid >$fifo $fifo