github.com/containers/podman/v5@v5.1.0-rc1/test/apiv2/80-kube.at (about) 1 # -*- sh -*- 2 # 3 # test more container-related endpoints 4 # 5 6 podman create $IMAGE true 7 8 t GET libpod/containers/json?last=1 200 \ 9 length=1 \ 10 .[0].Id~[0-9a-f]\\{64\\} \ 11 .[0].Image=$IMAGE \ 12 .[0].Command[0]="true" \ 13 .[0].IsInfra=false 14 15 cid=$(jq -r '.[0].Id' <<<"$output") 16 17 # Make sure that generate-kube works 18 19 t GET libpod/generate/kube?names=$cid 200 20 like "$output" ".*apiVersion:.*" "Check generated kube yaml - apiVersion" 21 like "$output" ".*kind:\\sPod.*" "Check generated kube yaml - kind: Pod" 22 like "$output" ".*metadata:.*" "Check generated kube yaml - metadata" 23 like "$output" ".*spec:.*" "Check generated kube yaml - spec" 24 25 t GET "libpod/generate/kube?service=true&names=$cid" 200 26 like "$output" ".*apiVersion:.*" "Check generated kube yaml(service=true) - apiVersion" 27 like "$output" ".*kind:\\sPod.*" "Check generated kube yaml(service=true) - kind: Pod" 28 like "$output" ".*metadata:.*" "Check generated kube yaml(service=true) - metadata" 29 like "$output" ".*spec:.*" "Check generated kube yaml(service=true) - spec" 30 like "$output" ".*kind:\\sService.*" "Check generated kube yaml(service=true) - kind: Service" 31 32 t GET "libpod/generate/kube?type=deployment&names=$cid" 200 33 like "$output" ".*apiVersion:.*" "Check generated kube yaml - apiVersion" 34 like "$output" ".*kind:\\sDeployment.*" "Check generated kube yaml - kind: Deployment" 35 like "$output" ".*metadata:.*" "Check generated kube yaml - metadata" 36 like "$output" ".*spec:.*" "Check generated kube yaml - spec" 37 38 TMPD=$(mktemp -d podman-apiv2-test-kube.XXXXXX) 39 YAML="${TMPD}/kube.yaml" 40 echo "$output" > $YAML 41 42 t DELETE libpod/containers/$cid 200 .[0].Id=$cid 43 44 # Make sure that kube-play works 45 46 t POST libpod/kube/play $YAML 200 \ 47 .Pods[0].ID~[0-9a-f]\\{64\\} \ 48 .Pods[0].ContainerErrors=null \ 49 .Pods[0].Containers[0]~[0-9a-f]\\{64\\} 50 51 t POST libpod/kube/play $YAML 500 52 53 t POST 'libpod/kube/play?replace=true' $YAML 200 \ 54 .Pods[0].ID~[0-9a-f]\\{64\\} \ 55 .Pods[0].ContainerErrors=null \ 56 .Pods[0].Containers[0]~[0-9a-f]\\{64\\} 57 58 t DELETE libpod/kube/play $YAML 200 \ 59 .StopReport[0].Id~[0-9a-f]\\{64\\} \ 60 .RmReport[0].Id~[0-9a-f]\\{64\\} 61 62 # Make sure that play-kube works 63 64 t POST libpod/play/kube $YAML 200 \ 65 .Pods[0].ID~[0-9a-f]\\{64\\} \ 66 .Pods[0].ContainerErrors=null \ 67 .Pods[0].Containers[0]~[0-9a-f]\\{64\\} 68 69 t DELETE libpod/play/kube $YAML 200 \ 70 .StopReport[0].Id~[0-9a-f]\\{64\\} \ 71 .RmReport[0].Id~[0-9a-f]\\{64\\} 72 73 rm -rf $TMPD 74 75 # vim: filetype=sh