summaryrefslogtreecommitdiff
path: root/test/apiv2
diff options
context:
space:
mode:
authorNiall Crowe <nicrowe@redhat.com>2022-06-24 15:43:05 +0100
committerNiall Crowe <nicrowe@redhat.com>2022-07-13 15:27:03 +0100
commite08a77ce64eec5cd0192ae1970fa859c00440174 (patch)
tree434b8a11abe0eb43a5a4e5e99ac4e04fdcc1730f /test/apiv2
parent4df6122aaa3bc858e9488d366a2c9c91b6671170 (diff)
downloadpodman-e08a77ce64eec5cd0192ae1970fa859c00440174.tar.gz
podman-e08a77ce64eec5cd0192ae1970fa859c00440174.tar.bz2
podman-e08a77ce64eec5cd0192ae1970fa859c00440174.zip
Add "podman kube play" cmd
The "podman kube play" command is designed to be a replacement for the "podman play kube" command. It performs the same function as "play kube" while also still working with the same flags and options. The "podman play kube" command is still functional as an alias of "kube play". Closes #12475 Signed-off-by: Niall Crowe <nicrowe@redhat.com> Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Diffstat (limited to 'test/apiv2')
-rw-r--r--test/apiv2/25-containersMore.at28
-rw-r--r--test/apiv2/80-kube.at50
-rwxr-xr-xtest/apiv2/test-apiv24
3 files changed, 53 insertions, 29 deletions
diff --git a/test/apiv2/25-containersMore.at b/test/apiv2/25-containersMore.at
index c9fda8c6f..9cdc2a33f 100644
--- a/test/apiv2/25-containersMore.at
+++ b/test/apiv2/25-containersMore.at
@@ -53,34 +53,6 @@ t POST libpod/containers/foo/unmount 204
t DELETE libpod/containers/foo?force=true 200
-podman run $IMAGE true
-
-t GET libpod/containers/json?last=1 200 \
- length=1 \
- .[0].Id~[0-9a-f]\\{64\\} \
- .[0].Image=$IMAGE \
- .[0].Command[0]="true" \
- .[0].State~\\\(exited\\\|stopped\\\) \
- .[0].ExitCode=0 \
- .[0].IsInfra=false
-
-cid=$(jq -r '.[0].Id' <<<"$output")
-
-t GET libpod/generate/kube?names=$cid 200
-like "$output" ".*apiVersion:.*" "Check generated kube yaml - apiVersion"
-like "$output" ".*kind:\\sPod.*" "Check generated kube yaml - kind: Pod"
-like "$output" ".*metadata:.*" "Check generated kube yaml - metadata"
-like "$output" ".*spec:.*" "Check generated kube yaml - spec"
-
-t GET "libpod/generate/kube?service=true&names=$cid" 200
-like "$output" ".*apiVersion:.*" "Check generated kube yaml(service=true) - apiVersion"
-like "$output" ".*kind:\\sPod.*" "Check generated kube yaml(service=true) - kind: Pod"
-like "$output" ".*metadata:.*" "Check generated kube yaml(service=true) - metadata"
-like "$output" ".*spec:.*" "Check generated kube yaml(service=true) - spec"
-like "$output" ".*kind:\\sService.*" "Check generated kube yaml(service=true) - kind: Service"
-
-t DELETE libpod/containers/$cid 200 .[0].Id=$cid
-
# Create 3 stopped containers to test containers prune
podman run $IMAGE true
podman run $IMAGE true
diff --git a/test/apiv2/80-kube.at b/test/apiv2/80-kube.at
new file mode 100644
index 000000000..40b26d75e
--- /dev/null
+++ b/test/apiv2/80-kube.at
@@ -0,0 +1,50 @@
+# -*- sh -*-
+#
+# test more container-related endpoints
+#
+
+podman create $IMAGE true
+
+t GET libpod/containers/json?last=1 200 \
+ length=1 \
+ .[0].Id~[0-9a-f]\\{64\\} \
+ .[0].Image=$IMAGE \
+ .[0].Command[0]="true" \
+ .[0].IsInfra=false
+
+cid=$(jq -r '.[0].Id' <<<"$output")
+
+# Make sure that generate-kube works
+
+t GET libpod/generate/kube?names=$cid 200
+like "$output" ".*apiVersion:.*" "Check generated kube yaml - apiVersion"
+like "$output" ".*kind:\\sPod.*" "Check generated kube yaml - kind: Pod"
+like "$output" ".*metadata:.*" "Check generated kube yaml - metadata"
+like "$output" ".*spec:.*" "Check generated kube yaml - spec"
+
+t GET "libpod/generate/kube?service=true&names=$cid" 200
+like "$output" ".*apiVersion:.*" "Check generated kube yaml(service=true) - apiVersion"
+like "$output" ".*kind:\\sPod.*" "Check generated kube yaml(service=true) - kind: Pod"
+like "$output" ".*metadata:.*" "Check generated kube yaml(service=true) - metadata"
+like "$output" ".*spec:.*" "Check generated kube yaml(service=true) - spec"
+like "$output" ".*kind:\\sService.*" "Check generated kube yaml(service=true) - kind: Service"
+
+TMPD=$(mktemp -d podman-apiv2-test-kube.XXXXXX)
+YAML="${TMPD}/kube.yaml"
+echo "$output" > $YAML
+
+t DELETE libpod/containers/$cid 200 .[0].Id=$cid
+
+# Make sure that kube-play works
+
+t POST libpod/kube/play $YAML 200
+t DELETE libpod/kube/play $YAML 200
+
+# Make sure that play-kube works
+
+t POST libpod/play/kube $YAML 200
+t DELETE libpod/play/kube $YAML 200
+
+rm -rf $TMPD
+
+# vim: filetype=sh
diff --git a/test/apiv2/test-apiv2 b/test/apiv2/test-apiv2
index 0fd282854..0c3c6e672 100755
--- a/test/apiv2/test-apiv2
+++ b/test/apiv2/test-apiv2
@@ -252,7 +252,7 @@ function t() {
fi
# POST and PUT requests may be followed by one or more key=value pairs.
# Slurp the command line until we see a 3-digit status code.
- if [[ $method = "POST" || $method == "PUT" ]]; then
+ if [[ $method = "POST" || $method == "PUT" || $method = "DELETE" ]]; then
local -a post_args
for arg; do
case "$arg" in
@@ -261,6 +261,8 @@ function t() {
*.tar) curl_args+=(--data-binary @$arg);
content_type="application/x-tar";
shift;;
+ *.yaml) curl_args+=(--data-binary @$arg);
+ shift;;
application/*) content_type="$arg";
shift;;
[1-9][0-9][0-9]) break;;