mirror of
https://github.com/containers/podman.git
synced 2025-05-21 17:16:22 +08:00
Add a system test to verify --runtime is preserved
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:

committed by
Matthew Heon

parent
3858fc1d01
commit
1b4933376f
@ -127,9 +127,6 @@ case "$PRIV_NAME" in
|
||||
echo "$_suns" >> /etc/environment
|
||||
source /etc/environment
|
||||
fi
|
||||
|
||||
# Reload to incorporate any changes from above
|
||||
source "$SCRIPT_BASE/lib.sh"
|
||||
;;
|
||||
rootless)
|
||||
_ru="export ROOTLESS_USER='${ROOTLESS_USER:-some${RANDOM}dude}'"
|
||||
|
@ -235,14 +235,7 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
|
||||
|
||||
ociRuntime := os.Getenv("OCI_RUNTIME")
|
||||
if ociRuntime == "" {
|
||||
var err error
|
||||
ociRuntime, err = exec.LookPath("crun")
|
||||
// If we cannot find the crun binary, setting to something static as we have no way
|
||||
// to return an error. The tests will fail and point out that the runc binary could
|
||||
// not be found nicely.
|
||||
if err != nil {
|
||||
ociRuntime = "/usr/bin/runc"
|
||||
}
|
||||
ociRuntime = "crun"
|
||||
}
|
||||
os.Setenv("DISABLE_HC_SYSTEMD", "true")
|
||||
CNIConfigDir := "/etc/cni/net.d"
|
||||
|
@ -460,4 +460,17 @@ json-file | f
|
||||
is "$output" "$expect" "podman run with --tz=local, matches host"
|
||||
}
|
||||
|
||||
# run with --runtime should preserve the named runtime
|
||||
@test "podman run : full path to --runtime is preserved" {
|
||||
skip_if_cgroupsv1
|
||||
skip_if_remote
|
||||
run_podman run -d --runtime '/usr/bin/crun' $IMAGE sleep 60
|
||||
cid="$output"
|
||||
|
||||
run_podman inspect --format '{{.OCIRuntime}}' $cid
|
||||
is "$output" "/usr/bin/crun"
|
||||
|
||||
run_podman kill $cid
|
||||
}
|
||||
|
||||
# vim: filetype=sh
|
||||
|
@ -253,6 +253,7 @@ function is_cgroupsv1() {
|
||||
! is_cgroupsv2
|
||||
}
|
||||
|
||||
# True if cgroups v2 are enabled
|
||||
function is_cgroupsv2() {
|
||||
cgroup_type=$(stat -f -c %T /sys/fs/cgroup)
|
||||
test "$cgroup_type" = "cgroup2fs"
|
||||
@ -305,6 +306,15 @@ function skip_if_no_selinux() {
|
||||
fi
|
||||
}
|
||||
|
||||
#######################
|
||||
# skip_if_cgroupsv1 # ...with an optional message
|
||||
#######################
|
||||
function skip_if_cgroupsv1() {
|
||||
if ! is_cgroupsv2; then
|
||||
skip "${1:-test requires cgroupsv2}"
|
||||
fi
|
||||
}
|
||||
|
||||
#########
|
||||
# die # Abort with helpful message
|
||||
#########
|
||||
|
Reference in New Issue
Block a user