summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndy Librian <andylibrian@gmail.com>2020-10-09 05:54:16 +0700
committerAndy Librian <andylibrian@gmail.com>2020-10-09 05:54:16 +0700
commit34a33d614efcd6c693cb86f6f1d7e4b8df8772ec (patch)
tree2a539fbe426ad53636a214c6df60edb9a5ab7ae4 /test
parent2587cba3899213356575f01cc0aa226c0209b8ae (diff)
downloadpodman-34a33d614efcd6c693cb86f6f1d7e4b8df8772ec.tar.gz
podman-34a33d614efcd6c693cb86f6f1d7e4b8df8772ec.tar.bz2
podman-34a33d614efcd6c693cb86f6f1d7e4b8df8772ec.zip
Add support for resource cpu limit to generate kube
fixes #7855 Signed-off-by: Andy Librian <andylibrian@gmail.com>
Diffstat (limited to 'test')
-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 05a7f4ddf..3c4a1008b 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -260,6 +260,38 @@ var _ = Describe("Podman generate kube", func() {
}
})
+ It("podman generate kube on pod with cpu limit", func() {
+ podName := "testCpuLimit"
+ 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,
+ "--cpus", "0.5", ALPINE, "top"})
+ ctr1Session.WaitWithDefaultTimeout()
+ Expect(ctr1Session.ExitCode()).To(Equal(0))
+
+ ctr2Name := "ctr2"
+ ctr2Session := podmanTest.Podman([]string{"create", "--name", ctr2Name, "--pod", podName,
+ "--cpu-period", "100000", "--cpu-quota", "50000", ALPINE, "top"})
+ ctr2Session.WaitWithDefaultTimeout()
+ Expect(ctr2Session.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 {
+ cpuLimit := ctr.Resources.Limits.Cpu().MilliValue()
+ Expect(cpuLimit).To(Equal(int64(500)))
+ }
+ })
+
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"})