diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-10-20 11:22:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-20 11:22:43 -0400 |
commit | 36682115b0f3f5f7cfcc6bc4580e5a7435b9a4d8 (patch) | |
tree | 9883d07d47e45ad05b53d1fa626d33b342ba5d5e /test | |
parent | 6c0b600e7d49d17db6eedd21b755b5d4f1a15b11 (diff) | |
parent | 1b4933376f4e6738ff3a0c42a2e27c6d21c07e7c (diff) | |
download | podman-36682115b0f3f5f7cfcc6bc4580e5a7435b9a4d8.tar.gz podman-36682115b0f3f5f7cfcc6bc4580e5a7435b9a4d8.tar.bz2 podman-36682115b0f3f5f7cfcc6bc4580e5a7435b9a4d8.zip |
Merge pull request #7126 from mheon/fix_missing_ociruntime
Fix missing OCI Runtime
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/common_test.go | 9 | ||||
-rw-r--r-- | test/endpoint/setup.go | 9 | ||||
-rw-r--r-- | test/system/030-run.bats | 13 | ||||
-rw-r--r-- | test/system/helpers.bash | 10 |
4 files changed, 25 insertions, 16 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index e36c86690..226b71627 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -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" diff --git a/test/endpoint/setup.go b/test/endpoint/setup.go index 56cab06b0..6bbc8d2bc 100644 --- a/test/endpoint/setup.go +++ b/test/endpoint/setup.go @@ -51,14 +51,7 @@ func Setup(tempDir string) *EndpointTestIntegration { ociRuntime := os.Getenv("OCI_RUNTIME") if ociRuntime == "" { - var err error - ociRuntime, err = exec.LookPath("runc") - // If we cannot find the runc 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 = "runc" } os.Setenv("DISABLE_HC_SYSTEMD", "true") CNIConfigDir := "/etc/cni/net.d" diff --git a/test/system/030-run.bats b/test/system/030-run.bats index 28dc7c7a7..9f4037730 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -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 diff --git a/test/system/helpers.bash b/test/system/helpers.bash index 73cf1e5b2..2cced10c2 100644 --- a/test/system/helpers.bash +++ b/test/system/helpers.bash @@ -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 ######### |