diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-10-08 15:05:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-08 15:05:42 +0200 |
commit | bd4d9a09520b2329b1cf3dd8cdf8194b8bdeab67 (patch) | |
tree | a3705e99f19f204f87bbb927d25e7c5988af3cec /test | |
parent | 14c0fcc6b7b3e8c1f28efea329ab9a6bf0d99b70 (diff) | |
parent | 6fc73ea4ea4fa8b82092fc605390d3cfece97dd1 (diff) | |
download | podman-bd4d9a09520b2329b1cf3dd8cdf8194b8bdeab67.tar.gz podman-bd4d9a09520b2329b1cf3dd8cdf8194b8bdeab67.tar.bz2 podman-bd4d9a09520b2329b1cf3dd8cdf8194b8bdeab67.zip |
Merge pull request #11671 from chenzhiwei/kube-replace
introduce --replace flag for play kube
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/play_kube_test.go | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index a29d0ad46..079bb53b5 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -2798,4 +2798,58 @@ invalid kube kind exists.WaitWithDefaultTimeout() Expect(exists).To(Exit(0)) }) + + It("podman play kube replace", 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)) + + containerLen := podmanTest.Podman([]string{"pod", "inspect", pod.Name, "--format", "'{{len .Containers}}'"}) + + ctr01Name := "ctr01" + ctr02Name := "ctr02" + + ctr01 := getCtr(withName(ctr01Name)) + ctr02 := getCtr(withName(ctr02Name)) + + newPod := getPod( + withCtr(ctr01), + withCtr(ctr02), + ) + err = generateKubeYaml("pod", newPod, kubeYaml) + Expect(err).To(BeNil()) + + replace := podmanTest.Podman([]string{"play", "kube", "--replace", kubeYaml}) + replace.WaitWithDefaultTimeout() + Expect(replace).Should(Exit(0)) + + newContainerLen := podmanTest.Podman([]string{"pod", "inspect", newPod.Name, "--format", "'{{len .Containers}}'"}) + newContainerLen.WaitWithDefaultTimeout() + Expect(newContainerLen).Should(Exit(0)) + Expect(newContainerLen.OutputToString()).NotTo(Equal(containerLen.OutputToString())) + }) + + It("podman play kube replace non-existing pod", func() { + pod := getPod() + err := generateKubeYaml("pod", pod, kubeYaml) + Expect(err).To(BeNil()) + + replace := podmanTest.Podman([]string{"play", "kube", "--replace", kubeYaml}) + replace.WaitWithDefaultTimeout() + Expect(replace).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)) + }) }) |