diff options
Diffstat (limited to 'test/system/030-run.bats')
-rw-r--r-- | test/system/030-run.bats | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/test/system/030-run.bats b/test/system/030-run.bats index 56e9fed3b..1bcf3896f 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -8,8 +8,8 @@ load helpers # 2019-09 Fedora 31 and rawhide (32) are switching from runc to crun # because of cgroups v2; crun emits different error messages. # Default to runc: - err_no_such_cmd="Error: .*: starting container process caused .*exec:.*stat /no/such/command: no such file or directory" - err_no_exec_dir="Error: .*: starting container process caused .*exec:.* permission denied" + err_no_such_cmd="Error: .*: starting container process caused.*exec:.*stat /no/such/command: no such file or directory" + err_no_exec_dir="Error: .*: starting container process caused.*exec:.* permission denied" # ...but check the configured runtime engine, and switch to crun as needed run_podman info --format '{{ .Host.OCIRuntime.Path }}' @@ -158,4 +158,34 @@ echo $rand | 0 | $rand run_podman 1 image exists $NONLOCAL_IMAGE } +# 'run --conmon-pidfile --cid-file' makes sure we don't regress on these flags. +# Both are critical for systemd units. +@test "podman run --conmon-pidfile --cidfile" { + pidfile=${PODMAN_TMPDIR}/pidfile + cidfile=${PODMAN_TMPDIR}/cidfile + + cname=$(random_string) + run_podman run --name $cname \ + --conmon-pidfile=$pidfile \ + --cidfile=$cidfile \ + --detach \ + $IMAGE sleep infinity + cid="$output" + + is "$(< $cidfile)" "$cid" "contents of cidfile == container ID" + + conmon_pid=$(< $pidfile) + is "$(readlink /proc/$conmon_pid/exe)" ".*/conmon" \ + "conmon pidfile (= PID $conmon_pid) points to conmon process" + + # All OK. Kill container. + run_podman rm -f $cid + + # Podman must not overwrite existing cid file. + # (overwriting conmon-pidfile is OK, so don't test that) + run_podman 125 run --cidfile=$cidfile $IMAGE true + is "$output" "Error: container id file exists. .* delete $cidfile" \ + "podman will not overwrite existing cidfile" +} + # vim: filetype=sh |