aboutsummaryrefslogtreecommitdiff
path: root/test/apiv2/80-kube.at
blob: f40a6556ed361dfe72342cdf038d902e32ed8338 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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