diff options
author | baude <bbaude@redhat.com> | 2021-02-10 13:39:09 -0600 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2021-02-10 14:17:58 -0600 |
commit | 5ccb1596b444e15cbefa55e3315e742f091af9d4 (patch) | |
tree | dfea8a5dee7c99b4ae103a074e92fa805da85f93 /test/e2e/inspect_test.go | |
parent | 4d604c10897da33b7b3677631d219481cec11c7f (diff) | |
download | podman-5ccb1596b444e15cbefa55e3315e742f091af9d4.tar.gz podman-5ccb1596b444e15cbefa55e3315e742f091af9d4.tar.bz2 podman-5ccb1596b444e15cbefa55e3315e742f091af9d4.zip |
Display correct value for unlimited ulimit
When doing a container inspect on a container with unlimited ulimits,
the value should be -1. But because the OCI spec requires the ulimit
value to be uint64, we were displaying the inspect values as a uint64 as
well. Simple change to display as an int64.
Fixes: #9303
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'test/e2e/inspect_test.go')
-rw-r--r-- | test/e2e/inspect_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/e2e/inspect_test.go b/test/e2e/inspect_test.go index 8fc9721f9..12bc886a8 100644 --- a/test/e2e/inspect_test.go +++ b/test/e2e/inspect_test.go @@ -466,4 +466,28 @@ var _ = Describe("Podman inspect", func() { Expect(len(inspect)).To(Equal(1)) Expect(len(inspect[0].NetworkSettings.Networks)).To(Equal(1)) }) + + It("Container inspect with unlimited uilimits should be -1", func() { + ctrName := "testctr" + session := podmanTest.Podman([]string{"run", "-d", "--ulimit", "core=-1:-1", "--name", ctrName, ALPINE, "top"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(BeZero()) + + inspect := podmanTest.Podman([]string{"inspect", ctrName}) + inspect.WaitWithDefaultTimeout() + Expect(inspect.ExitCode()).To(BeZero()) + + data := inspect.InspectContainerToJSON() + ulimits := data[0].HostConfig.Ulimits + Expect(len(ulimits)).To(BeNumerically(">", 0)) + found := false + for _, ulimit := range ulimits { + if ulimit.Name == "RLIMIT_CORE" { + found = true + Expect(ulimit.Soft).To(BeNumerically("==", -1)) + Expect(ulimit.Hard).To(BeNumerically("==", -1)) + } + } + Expect(found).To(BeTrue()) + }) }) |