summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-08-26 13:58:44 -0400
committerGitHub <noreply@github.com>2021-08-26 13:58:44 -0400
commit94c37d7d470871f9d63b32c97094f5faab1e8a08 (patch)
tree7597eba1d8c63fbf9c7fe19c1ee5255f9194a027 /test
parent70caa63e7cfc4a2b70722058be9f315b4a76defe (diff)
parente88b62b34bbd7cd0240a8717ba14f31e1856f832 (diff)
downloadpodman-94c37d7d470871f9d63b32c97094f5faab1e8a08.tar.gz
podman-94c37d7d470871f9d63b32c97094f5faab1e8a08.tar.bz2
podman-94c37d7d470871f9d63b32c97094f5faab1e8a08.zip
Merge pull request #11298 from baude/kubeupdown
teardown play kube
Diffstat (limited to 'test')
-rw-r--r--test/e2e/play_kube_test.go64
1 files changed, 64 insertions, 0 deletions
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index eec4b43a5..ab496f0eb 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -2527,4 +2527,68 @@ invalid kube kind
Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring(`map[]`))
})
+
+ It("podman play kube teardown", func() {
+ pod := getPod()
+ err := generateKubeYaml("pod", pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ ls := podmanTest.Podman([]string{"pod", "ps", "--format", "'{{.ID}}'"})
+ ls.WaitWithDefaultTimeout()
+ Expect(ls).Should(Exit(0))
+ Expect(len(ls.OutputToStringArray())).To(Equal(1))
+
+ // teardown
+ teardown := podmanTest.Podman([]string{"play", "kube", "--down", kubeYaml})
+ teardown.WaitWithDefaultTimeout()
+ Expect(teardown).Should(Exit(0))
+
+ checkls := podmanTest.Podman([]string{"pod", "ps", "--format", "'{{.ID}}'"})
+ checkls.WaitWithDefaultTimeout()
+ Expect(checkls).Should(Exit(0))
+ Expect(len(checkls.OutputToStringArray())).To(Equal(0))
+ })
+
+ It("podman play kube teardown pod does not exist", func() {
+ // teardown
+ teardown := podmanTest.Podman([]string{"play", "kube", "--down", kubeYaml})
+ teardown.WaitWithDefaultTimeout()
+ Expect(teardown).Should(Exit(125))
+ })
+
+ It("podman play kube teardown with volume", func() {
+
+ volName := RandomString(12)
+ volDevice := "tmpfs"
+ volType := "tmpfs"
+ volOpts := "nodev,noexec"
+
+ pvc := getPVC(withPVCName(volName),
+ withPVCAnnotations(util.VolumeDeviceAnnotation, volDevice),
+ withPVCAnnotations(util.VolumeTypeAnnotation, volType),
+ withPVCAnnotations(util.VolumeMountOptsAnnotation, volOpts))
+ err = generateKubeYaml("persistentVolumeClaim", pvc, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ exists := podmanTest.Podman([]string{"volume", "exists", volName})
+ exists.WaitWithDefaultTimeout()
+ Expect(exists).To(Exit(0))
+
+ teardown := podmanTest.Podman([]string{"play", "kube", "--down", kubeYaml})
+ teardown.WaitWithDefaultTimeout()
+ Expect(teardown).To(Exit(0))
+
+ // volume should not be deleted on teardown
+ exists = podmanTest.Podman([]string{"volume", "exists", volName})
+ exists.WaitWithDefaultTimeout()
+ Expect(exists).To(Exit(0))
+ })
})