diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-10-05 12:15:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-05 12:15:04 +0200 |
commit | 436dda23852a367807d86e98b7a59f09a82c1802 (patch) | |
tree | 8e177f67269228aeba64e61a60f9b252f81a3038 /test/e2e/generate_kube_test.go | |
parent | a9d572f40f006a69b9d0634afea142d37c071474 (diff) | |
parent | 62607e7f27458a9ecacb6ffc4b4a7f777f94a0bc (diff) | |
download | podman-436dda23852a367807d86e98b7a59f09a82c1802.tar.gz podman-436dda23852a367807d86e98b7a59f09a82c1802.tar.bz2 podman-436dda23852a367807d86e98b7a59f09a82c1802.zip |
Merge pull request #7913 from andylibrian/kube-generate-support-resource-limits-7855
Add support for resource memory limit to generate kube
Diffstat (limited to 'test/e2e/generate_kube_test.go')
-rw-r--r-- | test/e2e/generate_kube_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go index a3a841dc6..05a7f4ddf 100644 --- a/test/e2e/generate_kube_test.go +++ b/test/e2e/generate_kube_test.go @@ -235,6 +235,31 @@ var _ = Describe("Podman generate kube", func() { } }) + It("podman generate kube on pod with memory limit", func() { + podName := "testMemoryLimit" + podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName}) + podSession.WaitWithDefaultTimeout() + Expect(podSession.ExitCode()).To(Equal(0)) + + ctr1Name := "ctr1" + ctr1Session := podmanTest.Podman([]string{"create", "--name", ctr1Name, "--pod", podName, "--memory", "10Mi", ALPINE, "top"}) + ctr1Session.WaitWithDefaultTimeout() + Expect(ctr1Session.ExitCode()).To(Equal(0)) + + kube := podmanTest.Podman([]string{"generate", "kube", podName}) + 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 pod.Spec.Containers { + memoryLimit, _ := ctr.Resources.Limits.Memory().AsInt64() + Expect(memoryLimit).To(Equal(int64(10 * 1024 * 1024))) + } + }) + It("podman generate kube on pod with ports", func() { podName := "test" podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName, "-p", "4000:4000", "-p", "5000:5000"}) |