summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-03-08 10:06:56 -0500
committerGitHub <noreply@github.com>2021-03-08 10:06:56 -0500
commitbbb9d9b0781b06e189406cee95a64a415f9ed577 (patch)
tree6845dbcf804f56f6c1eba10d4c9f9b220569231a /test/e2e
parent6fe634c9165367ecf797794f016dd640bc28ff2f (diff)
parent0e36e65eaa1bab89b5d0a7a66253338e723429c5 (diff)
downloadpodman-bbb9d9b0781b06e189406cee95a64a415f9ed577.tar.gz
podman-bbb9d9b0781b06e189406cee95a64a415f9ed577.tar.bz2
podman-bbb9d9b0781b06e189406cee95a64a415f9ed577.zip
Merge pull request #9649 from rhatdan/kube
Allow users to generate a kubernetes yaml off non running containers
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/generate_kube_test.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go
index d7c697f28..21e006c20 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -734,4 +734,36 @@ ENTRYPOINT /bin/sleep`
kube.WaitWithDefaultTimeout()
Expect(kube.ExitCode()).To(Equal(0))
})
+
+ It("podman generate kube based on user in container", func() {
+ // Build an image with an entrypoint.
+ containerfile := `FROM quay.io/libpod/alpine:latest
+RUN adduser -u 10001 -S test1
+USER test1`
+
+ targetPath, err := CreateTempDirInTempDir()
+ Expect(err).To(BeNil())
+ containerfilePath := filepath.Join(targetPath, "Containerfile")
+ err = ioutil.WriteFile(containerfilePath, []byte(containerfile), 0644)
+ Expect(err).To(BeNil())
+
+ image := "generatekube:test"
+ session := podmanTest.Podman([]string{"build", "-f", containerfilePath, "-t", image})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"create", "--pod", "new:testpod", image, "test1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ kube := podmanTest.Podman([]string{"generate", "kube", "testpod"})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+
+ pod := new(v1.Pod)
+ err = yaml.Unmarshal(kube.Out.Contents(), pod)
+ Expect(err).To(BeNil())
+ Expect(*pod.Spec.Containers[0].SecurityContext.RunAsUser).To(Equal(int64(10001)))
+ })
+
})