Files
podman/test/system/420-cgroups.bats
Ed Santiago d4a62ff932 System tests: fix three races
Three tests were running 'container rm' on 'start'ed containers
that might not yet have exited. Fix. Also, tighten up the
tests themselves, to make even more sure that they test
what they're supposed to test.

Discovered, in CI, that 'podman-remote logs --timestamps'
was unimplemented. Thanks to @Luap99 for the fix to that.

Fixes: #15783
Fixes: #15795

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-09-14 10:49:18 -06:00

41 lines
1.3 KiB
Bash

#!/usr/bin/env bats -*- bats -*-
#
# cgroups-related tests
#
load helpers
@test "podman run, preserves initial --cgroup-manager" {
skip_if_remote "podman-remote does not support --cgroup-manager"
skip_if_rootless_cgroupsv1
# Find out our default cgroup manager, and from that, get the non-default
run_podman info --format '{{.Host.CgroupManager}}'
case "$output" in
systemd) other="cgroupfs" ;;
cgroupfs) other="systemd" ;;
*) die "Unknown CgroupManager '$output'" ;;
esac
run_podman --cgroup-manager=$other run --name myc $IMAGE true
assert "$output" = "" "run true, with cgroup-manager=$other, is silent"
run_podman container inspect --format '{{.HostConfig.CgroupManager}}' myc
is "$output" "$other" "podman preserved .HostConfig.CgroupManager"
if is_rootless && test $other = cgroupfs ; then
run_podman container inspect --format '{{.HostConfig.CgroupParent}}' myc
is "$output" "" "podman didn't set .HostConfig.CgroupParent for cgroupfs and rootless"
fi
# Restart the container, without --cgroup-manager option (ie use default)
# Prior to #7970, this would fail with an OCI runtime error
run_podman start -a myc
assert "$output" = "" "restarted container emits no output"
run_podman rm myc
}
# vim: filetype=sh