summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-12-20 12:52:30 +0100
committerGitHub <noreply@github.com>2021-12-20 12:52:30 +0100
commit516c16c366531ec8c05a496bf3ffe1c6386aedc6 (patch)
tree0d3d144f6f4b03cc5f8c16e9ae686fcbf8f4928e /test
parentf45070ee0e63ea26e475e618ff32a498096fa561 (diff)
parentaf6bcd086794668889a2695e02ea89cff966ae35 (diff)
downloadpodman-516c16c366531ec8c05a496bf3ffe1c6386aedc6.tar.gz
podman-516c16c366531ec8c05a496bf3ffe1c6386aedc6.tar.bz2
podman-516c16c366531ec8c05a496bf3ffe1c6386aedc6.zip
Merge pull request #12648 from ttys3/fix-generate-kube-env-missing
fix(generate): fix up podman generate kube missing env field bug
Diffstat (limited to 'test')
-rw-r--r--test/e2e/generate_kube_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go
index cfa264de2..16f2c4272 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -1100,4 +1100,28 @@ USER test1`
Expect(pod.GetAnnotations()).To(HaveKeyWithValue("io.containers.autoupdate.authfile/"+ctr, "/some/authfile.json"))
}
})
+
+ It("podman generate kube can export env variables correctly", func() {
+ // Fixes https://github.com/containers/podman/issues/12647
+ // PR https://github.com/containers/podman/pull/12648
+
+ ctrName := "gen-kube-env-ctr"
+ podName := "gen-kube-env"
+ session1 := podmanTest.Podman([]string{"run", "-d", "--pod", "new:" + podName, "--name", ctrName,
+ "-e", "FOO=bar",
+ "-e", "HELLO=WORLD",
+ "alpine", "top"})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+
+ kube := podmanTest.Podman([]string{"generate", "kube", podName})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ pod := new(v1.Pod)
+ err := yaml.Unmarshal(kube.Out.Contents(), pod)
+ Expect(err).To(BeNil())
+
+ Expect(pod.Spec.Containers[0].Env).To(HaveLen(2))
+ })
})