summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2020-02-26 09:17:13 -0700
committerEd Santiago <santiago@redhat.com>2020-03-02 13:19:42 -0700
commit56120894125b0859a81af2f96062157465b56e87 (patch)
treeb9ca20ae31bb4f884ae7818a08004b5af55dced4 /test
parent47c4ea39196cedac87e7a4e4c1ead54ed9d7ed50 (diff)
downloadpodman-56120894125b0859a81af2f96062157465b56e87.tar.gz
podman-56120894125b0859a81af2f96062157465b56e87.tar.bz2
podman-56120894125b0859a81af2f96062157465b56e87.zip
CI: add API v2 tests
API v2 has been quiet for a few days, and the test script is actually passing. Let's take advantage of this opportunity to get them running in CI. Requires adding a check for cgroupsv2 Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/apiv2/01-basic.at12
-rw-r--r--test/apiv2/40-pods.at3
-rwxr-xr-xtest/apiv2/test-apiv26
3 files changed, 17 insertions, 4 deletions
diff --git a/test/apiv2/01-basic.at b/test/apiv2/01-basic.at
index b8a049cdf..0e94ddb7a 100644
--- a/test/apiv2/01-basic.at
+++ b/test/apiv2/01-basic.at
@@ -41,10 +41,16 @@ t GET libpod/containers/create 405
#
# system info
#
+# Some day perhaps it will always be runc; for now, cgroupsv2 requires crun
+#
# FIXME: run 'podman info --format=json', and compare select fields
-t GET info 200 \
- .OSType=linux \
- .DefaultRuntime=runc \
+runtime=runc
+if have_cgroupsv2; then
+ runtime=crun
+fi
+t GET info 200 \
+ .OSType=linux \
+ .DefaultRuntime~.*$runtime \
.MemTotal~[0-9]\\+
# Timing: make sure server stays responsive
diff --git a/test/apiv2/40-pods.at b/test/apiv2/40-pods.at
index 8b5651cff..ab345b8f2 100644
--- a/test/apiv2/40-pods.at
+++ b/test/apiv2/40-pods.at
@@ -23,9 +23,10 @@ t POST libpod/pods/create name=foo 409 .cause="pod already exists"
#t POST libpod/pods/create a=b 400 .cause='bad parameter' # FIXME: unimplemented
-if root; then
+if root || have_cgroupsv2; then
t POST libpod/pods/foo/pause '' 204
else
+ # Rootless cgroupsv1 : unsupported
t POST libpod/pods/foo/pause '' 500 \
.cause="this container does not have a cgroup" \
.message~".*pause pods containing rootless containers with cgroup V1"
diff --git a/test/apiv2/test-apiv2 b/test/apiv2/test-apiv2
index bc2ed142c..f0fb4ae34 100755
--- a/test/apiv2/test-apiv2
+++ b/test/apiv2/test-apiv2
@@ -290,6 +290,12 @@ function rootless() {
test "$ROOTLESS" = "true"
}
+# True if cgroups v2 are enabled
+function have_cgroupsv2() {
+ cgroup_type=$(stat -f -c %T /sys/fs/cgroup)
+ test "$cgroup_type" = "cgroup2fs"
+}
+
# END infrastructure code
###############################################################################
# BEGIN sanity checks