summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-02-25 21:16:11 +0100
committerGitHub <noreply@github.com>2020-02-25 21:16:11 +0100
commit930ae43e8dec5b5f2d1039418ce94357a2d1833e (patch)
treef94ccd80ff0071a0cd82241d751b5b77d850901a
parentd3aa64c77c501b630ae2e0a227e10c38e14b1f4f (diff)
parentf25c595cb8af5d6fe491d6974f206d6a5db552cb (diff)
downloadpodman-930ae43e8dec5b5f2d1039418ce94357a2d1833e.tar.gz
podman-930ae43e8dec5b5f2d1039418ce94357a2d1833e.tar.bz2
podman-930ae43e8dec5b5f2d1039418ce94357a2d1833e.zip
Merge pull request #5313 from edsantiago/test_apiv2
apiv2 tests: add more pod tests, timing check
-rw-r--r--test/apiv2/01-basic.at15
-rw-r--r--test/apiv2/40-pods.at26
-rwxr-xr-xtest/apiv2/test-apiv22
3 files changed, 31 insertions, 12 deletions
diff --git a/test/apiv2/01-basic.at b/test/apiv2/01-basic.at
index a54063260..b8a049cdf 100644
--- a/test/apiv2/01-basic.at
+++ b/test/apiv2/01-basic.at
@@ -47,4 +47,19 @@ t GET info 200 \
.DefaultRuntime=runc \
.MemTotal~[0-9]\\+
+# Timing: make sure server stays responsive
+t0=$SECONDS
+for i in $(seq 1 10); do
+ # FIXME: someday: refactor t(), separate out the 'curl' logic so we
+ # can call it directly. Then we won't get ten annoying 'ok' lines.
+ t GET info 200
+done
+t1=$SECONDS
+delta_t=$((t1 - t2))
+if [ $delta_t -le 5 ]; then
+ _show_ok 1 "Time for ten /info requests ($delta_t seconds) <= 5s"
+else
+ _show_ok 0 "Time for ten /info requests" "<= 5 seconds" "$delta_t seconds"
+fi
+
# vim: filetype=sh
diff --git a/test/apiv2/40-pods.at b/test/apiv2/40-pods.at
index 705de94d2..8b5651cff 100644
--- a/test/apiv2/40-pods.at
+++ b/test/apiv2/40-pods.at
@@ -3,18 +3,20 @@
# test pod-related endpoints
#
-# FIXME! Shouldn't /create give an actual pod ID?
-expected_id='machine.slice'
-if rootless; then
- expected_id=/libpod_parent
-fi
-
t GET libpod/pods/json 200 null
-t POST libpod/pods/create name=foo 201 .id=$expected_id
+t POST libpod/pods/create name=foo 201 .id~[0-9a-f]\\{64\\}
+pod_id=$(jq -r .id <<<"$output")
t GET libpod/pods/foo/exists 204
+t GET libpod/pods/$pod_id/exists 204
t GET libpod/pods/notfoo/exists 404
-t GET libpod/pods/foo/json 200 .Config.name=foo .Containers=null
-t GET libpod/pods/json 200 .[0].Config.name=foo .[0].Containers=null
+t GET libpod/pods/foo/json 200 \
+ .Config.name=foo \
+ .Config.id=$pod_id \
+ .Containers=null
+t GET libpod/pods/json 200 \
+ .[0].Config.name=foo \
+ .[0].Config.id=$pod_id \
+ .[0].Containers=null
# Cannot create a dup pod with the same name
t POST libpod/pods/create name=foo 409 .cause="pod already exists"
@@ -35,8 +37,10 @@ t POST libpod/pods/foo/restart '' 500 .cause="no such container"
t POST libpod/pods/bar/restart '' 404
-#t POST libpod/pods/prune '' 200 # FIXME: unimplemented, returns 500
-#t POST libpod/pods/prune 'a=b' 400 # FIXME: unimplemented, returns 500
+# FIXME: I'm not sure what 'prune' is supposed to do; as of 20200224 it
+# just returns 200 (ok) with empty result list.
+#t POST libpod/pods/prune '' 200 # FIXME: 2020-02-24 returns 200 {}
+#t POST libpod/pods/prune 'a=b' 400 # FIXME: 2020-02-24 returns 200
# Clean up; and try twice, making sure that the second time fails
t DELETE libpod/pods/foo 204
diff --git a/test/apiv2/test-apiv2 b/test/apiv2/test-apiv2
index fffd7b085..bc2ed142c 100755
--- a/test/apiv2/test-apiv2
+++ b/test/apiv2/test-apiv2
@@ -253,7 +253,7 @@ function start_service() {
die "Cannot start service on non-localhost ($HOST)"
fi
- $PODMAN_BIN --root $WORKDIR system service --timeout 15000 tcp:127.0.0.1:$PORT \
+ $PODMAN_BIN --root $WORKDIR system service --timeout 15 tcp:127.0.0.1:$PORT \
&> $WORKDIR/server.log &
service_pid=$!