diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-05-07 05:36:26 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-07 05:36:26 -0400 |
commit | 0c411278ce89c8db1569da6333001c41c78ca0a2 (patch) | |
tree | 15fa1c8439ae3c0adc9bd5fa9e74ecd2d61cad56 /test/e2e/generate_kube_test.go | |
parent | 141ba94f9735d88a494f252ad7aa78fd4b86d8ea (diff) | |
parent | 72f4f389f0a77d226e36413cb54c3867ae25700d (diff) | |
download | podman-0c411278ce89c8db1569da6333001c41c78ca0a2.tar.gz podman-0c411278ce89c8db1569da6333001c41c78ca0a2.tar.bz2 podman-0c411278ce89c8db1569da6333001c41c78ca0a2.zip |
Merge pull request #10202 from EduardoVega/9763-kube-auto-update
Add support to preserve auto-update labels in play / generate kube
Diffstat (limited to 'test/e2e/generate_kube_test.go')
-rw-r--r-- | test/e2e/generate_kube_test.go | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go index 611e8ddac..4c0fc6db0 100644 --- a/test/e2e/generate_kube_test.go +++ b/test/e2e/generate_kube_test.go @@ -873,4 +873,54 @@ USER test1` } } }) + + It("podman generate kube on container with auto update labels", func() { + top := podmanTest.Podman([]string{"run", "-dt", "--name", "top", "--label", "io.containers.autoupdate=local", ALPINE, "top"}) + top.WaitWithDefaultTimeout() + Expect(top.ExitCode()).To(Equal(0)) + + kube := podmanTest.Podman([]string{"generate", "kube", "top"}) + kube.WaitWithDefaultTimeout() + Expect(kube.ExitCode()).To(Equal(0)) + + pod := new(v1.Pod) + err := yaml.Unmarshal(kube.Out.Contents(), pod) + Expect(err).To(BeNil()) + + v, ok := pod.GetAnnotations()["io.containers.autoupdate/top"] + Expect(ok).To(Equal(true)) + Expect(v).To(Equal("local")) + }) + + It("podman generate kube on pod with auto update labels in all containers", func() { + pod1 := podmanTest.Podman([]string{"pod", "create", "--name", "pod1"}) + pod1.WaitWithDefaultTimeout() + Expect(pod1.ExitCode()).To(Equal(0)) + + top1 := podmanTest.Podman([]string{"run", "-dt", "--name", "top1", "--pod", "pod1", "--label", "io.containers.autoupdate=registry", "--label", "io.containers.autoupdate.authfile=/some/authfile.json", ALPINE, "top"}) + top1.WaitWithDefaultTimeout() + Expect(top1.ExitCode()).To(Equal(0)) + + top2 := podmanTest.Podman([]string{"run", "-dt", "--name", "top2", "--pod", "pod1", "--label", "io.containers.autoupdate=registry", "--label", "io.containers.autoupdate.authfile=/some/authfile.json", ALPINE, "top"}) + top2.WaitWithDefaultTimeout() + Expect(top2.ExitCode()).To(Equal(0)) + + kube := podmanTest.Podman([]string{"generate", "kube", "pod1"}) + kube.WaitWithDefaultTimeout() + Expect(kube.ExitCode()).To(Equal(0)) + + pod := new(v1.Pod) + err := yaml.Unmarshal(kube.Out.Contents(), pod) + Expect(err).To(BeNil()) + + for _, ctr := range []string{"top1", "top2"} { + v, ok := pod.GetAnnotations()["io.containers.autoupdate/"+ctr] + Expect(ok).To(Equal(true)) + Expect(v).To(Equal("registry")) + + v, ok = pod.GetAnnotations()["io.containers.autoupdate.authfile/"+ctr] + Expect(ok).To(Equal(true)) + Expect(v).To(Equal("/some/authfile.json")) + } + }) }) |