summaryrefslogtreecommitdiff
path: root/test/apiv2/80-kube.at
diff options
context:
space:
mode:
Diffstat (limited to 'test/apiv2/80-kube.at')
-rw-r--r--test/apiv2/80-kube.at66
1 files changed, 66 insertions, 0 deletions
diff --git a/test/apiv2/80-kube.at b/test/apiv2/80-kube.at
new file mode 100644
index 000000000..f40a6556e
--- /dev/null
+++ b/test/apiv2/80-kube.at
@@ -0,0 +1,66 @@
+# -*- 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 \
+ .Pods[0].ID~[0-9a-f]\\{64\\} \
+ .Pods[0].ContainerErrors=null \
+ .Pods[0].Containers[0]~[0-9a-f]\\{64\\}
+
+t DELETE libpod/kube/play $YAML 200 \
+ .Pods[0].ID~null \
+ .Pods[0].ContainerErrors=null \
+ .Pods[0].Containers[0]~null
+
+# Make sure that play-kube works
+
+t POST libpod/play/kube $YAML 200 \
+ .Pods[0].ID~[0-9a-f]\\{64\\} \
+ .Pods[0].ContainerErrors=null \
+ .Pods[0].Containers[0]~[0-9a-f]\\{64\\}
+
+t DELETE libpod/play/kube $YAML 200 \
+ .Pods[0].ID~null \
+ .Pods[0].ContainerErrors=null \
+ .Pods[0].Containers[0]~null \
+ .StopReport[0].Id~[0-9a-f]\\{64\\} \
+ .RmReport[0].Id~[0-9a-f]\\{64\\}
+
+rm -rf $TMPD
+
+# vim: filetype=sh