summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-09-22 13:39:18 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2021-09-22 15:10:37 -0400
commit45ee5c5db2d67e17f4271fab5f61b7cafb6aea10 (patch)
tree71200634486aee02e2733ebe3f1d31581433ca11 /test
parent420ff1da921e284b80ac3724408a21bba102a533 (diff)
downloadpodman-45ee5c5db2d67e17f4271fab5f61b7cafb6aea10.tar.gz
podman-45ee5c5db2d67e17f4271fab5f61b7cafb6aea10.tar.bz2
podman-45ee5c5db2d67e17f4271fab5f61b7cafb6aea10.zip
podman generate kube should not include images command
If the command came from the underlying image, then we should not include it in the generate yaml file. Fixes: https://github.com/containers/podman/issues/11672 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/generate_kube_test.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go
index bf89a0708..cb556991c 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -792,6 +792,45 @@ var _ = Describe("Podman generate kube", func() {
Expect(containers[0].Args).To(Equal([]string{"10s"}))
})
+ It("podman generate kube - no command", func() {
+ session := podmanTest.Podman([]string{"create", "--name", "test", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ kube := podmanTest.Podman([]string{"generate", "kube", "test"})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ // Now make sure that the container's command is not set to the
+ // entrypoint and it's arguments to "10s".
+ pod := new(v1.Pod)
+ err := yaml.Unmarshal(kube.Out.Contents(), pod)
+ Expect(err).To(BeNil())
+
+ containers := pod.Spec.Containers
+ Expect(len(containers)).To(Equal(1))
+ Expect(len(containers[0].Command)).To(Equal(0))
+
+ cmd := []string{"echo", "hi"}
+ session = podmanTest.Podman(append([]string{"create", "--name", "test1", ALPINE}, cmd...))
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ kube = podmanTest.Podman([]string{"generate", "kube", "test1"})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ // Now make sure that the container's command is not set to the
+ // entrypoint and it's arguments to "10s".
+ pod = new(v1.Pod)
+ err = yaml.Unmarshal(kube.Out.Contents(), pod)
+ Expect(err).To(BeNil())
+
+ containers = pod.Spec.Containers
+ Expect(len(containers)).To(Equal(1))
+ Expect(containers[0].Command).To(Equal(cmd))
+ })
+
It("podman generate kube - use entrypoint from image", func() {
// Build an image with an entrypoint.
containerfile := `FROM quay.io/libpod/alpine:latest