diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2021-09-30 15:22:47 +0200 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2021-09-30 16:08:43 +0200 |
commit | 9c6c981928c3e020ff6eef9454c7ee86aa8c83d1 (patch) | |
tree | 9898a250af2a93ec4451028a31d1117edfe5d320 /test/e2e | |
parent | 39d27cc6cc065aea4ab12b646906a8ea06e30de9 (diff) | |
download | podman-9c6c981928c3e020ff6eef9454c7ee86aa8c83d1.tar.gz podman-9c6c981928c3e020ff6eef9454c7ee86aa8c83d1.tar.bz2 podman-9c6c981928c3e020ff6eef9454c7ee86aa8c83d1.zip |
kube: fix conversion from milliCPU to period/quota
Closes: https://github.com/containers/podman/issues/11803
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r-- | test/e2e/play_kube_test.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index 0d5b9d52c..83ce751e6 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -2320,6 +2320,39 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`}) } }) + It("podman play kube allows setting resource limits with --cpus 1", func() { + SkipIfContainerized("Resource limits require a running systemd") + SkipIfRootless("CPU limits require root") + podmanTest.CgroupManager = "systemd" + + var ( + expectedCpuLimit string = "1" + ) + + deployment := getDeployment( + withPod(getPod(withCtr(getCtr( + withCpuLimit(expectedCpuLimit), + ))))) + err := generateKubeYaml("deployment", deployment, kubeYaml) + Expect(err).To(BeNil()) + + kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube.WaitWithDefaultTimeout() + Expect(kube).Should(Exit(0)) + + for _, pod := range getPodNamesInDeployment(deployment) { + inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(&pod), "--format", `{{ .HostConfig.CpuPeriod }}:{{ .HostConfig.CpuQuota }}`}) + + inspect.WaitWithDefaultTimeout() + Expect(inspect).Should(Exit(0)) + + parts := strings.Split(strings.Trim(inspect.OutputToString(), "\n"), ":") + Expect(parts).To(HaveLen(2)) + + Expect(parts[0]).To(Equal(parts[1])) + } + }) + It("podman play kube reports invalid image name", func() { invalidImageName := "./myimage" |