diff options
author | Urvashi Mohnani <umohnani@redhat.com> | 2022-03-04 15:01:46 -0500 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2022-03-30 13:38:08 -0400 |
commit | 5aa6b6919874815a12d28aaf1262bb3ec1de3be4 (patch) | |
tree | 19d037f4cfeead3878ff913f1b3b3633b2709e97 /test | |
parent | f002a0c8898bf187d5071b86ee0d1c5e07cf6416 (diff) | |
download | podman-5aa6b6919874815a12d28aaf1262bb3ec1de3be4.tar.gz podman-5aa6b6919874815a12d28aaf1262bb3ec1de3be4.tar.bz2 podman-5aa6b6919874815a12d28aaf1262bb3ec1de3be4.zip |
Throw an error if kube yaml has duplicate ctr names
Error out if the kube yaml passed to play kube has more
than one container or init container with the same name.
Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/play_kube_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index f0f0c6dc4..dbd5a044a 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -1888,6 +1888,26 @@ var _ = Describe("Podman play kube", func() { Expect(kube).Should(Exit(0)) }) + It("podman play kube test duplicate container name", func() { + p := getPod(withCtr(getCtr(withName("testctr"), withCmd([]string{"echo", "hello"}))), withCtr(getCtr(withName("testctr"), withCmd([]string{"echo", "world"})))) + + err := generateKubeYaml("pod", p, kubeYaml) + Expect(err).To(BeNil()) + + kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube.WaitWithDefaultTimeout() + Expect(kube).To(ExitWithError()) + + p = getPod(withPodInitCtr(getCtr(withImage(ALPINE), withCmd([]string{"echo", "hello"}), withInitCtr(), withName("initctr"))), withCtr(getCtr(withImage(ALPINE), withName("initctr"), withCmd([]string{"top"})))) + + err = generateKubeYaml("pod", p, kubeYaml) + Expect(err).To(BeNil()) + + kube = podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube.WaitWithDefaultTimeout() + Expect(kube).To(ExitWithError()) + }) + It("podman play kube test hostname", func() { pod := getPod() err := generateKubeYaml("pod", pod, kubeYaml) |