summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2021-08-16 09:37:50 -0500
committerBrent Baude <bbaude@redhat.com>2021-08-24 14:26:14 -0500
commit1e176923b15360559d859000f2fb0c0a3e30f792 (patch)
tree5a888021a0fa58375ebe947b86e5dc37fd8d22a0 /test/e2e
parente9daaf62e3921b8c696f3abd92f001a9447c8aa1 (diff)
downloadpodman-1e176923b15360559d859000f2fb0c0a3e30f792.tar.gz
podman-1e176923b15360559d859000f2fb0c0a3e30f792.tar.bz2
podman-1e176923b15360559d859000f2fb0c0a3e30f792.zip
teardown play kube
add the ability for play kube to tear down based on the yaml used to play it. it is indicated by --down in the play kube command. volumes are NOT deleted during the teardown. pods and their containers are stopped and removed. Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'test/e2e')
-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))
+ })
})