diff options
author | Jhon Honce <jhonce@redhat.com> | 2021-08-02 14:09:55 -0700 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2021-08-30 13:34:34 -0400 |
commit | f363b805c59ed4d25d89f08e3a099e5c7028eb2f (patch) | |
tree | c7143d9a08e039192b330e1a0d78d56a0590aa46 /test | |
parent | d1ea5454939745f98c42c00269fd646a08c5b6ac (diff) | |
download | podman-f363b805c59ed4d25d89f08e3a099e5c7028eb2f.tar.gz podman-f363b805c59ed4d25d89f08e3a099e5c7028eb2f.tar.bz2 podman-f363b805c59ed4d25d89f08e3a099e5c7028eb2f.zip |
Fix file descriptor leaks and add test
* Add response.Body.Close() where needed to release HTTP
connections to API server.
* Add tests to ensure no general leaks occur. 100% coverage would be
required to ensure no leaks on any call.
* Update code comments to be godoc correct
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/run_test.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 57d57554c..109a189cd 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -1315,10 +1315,10 @@ USER mail`, BB) } curCgroupsBytes, err := ioutil.ReadFile("/proc/self/cgroup") - Expect(err).To(BeNil()) - var curCgroups string = string(curCgroupsBytes) + Expect(err).ShouldNot(HaveOccurred()) + var curCgroups = string(curCgroupsBytes) fmt.Printf("Output:\n%s\n", curCgroups) - Expect(curCgroups).To(Not(Equal(""))) + Expect(curCgroups).ToNot(Equal("")) ctrName := "testctr" container := podmanTest.Podman([]string{"run", "--name", ctrName, "-d", "--cgroups=disabled", ALPINE, "top"}) @@ -1329,14 +1329,14 @@ USER mail`, BB) inspectOut := podmanTest.InspectContainer(ctrName) Expect(len(inspectOut)).To(Equal(1)) pid := inspectOut[0].State.Pid - Expect(pid).To(Not(Equal(0))) + Expect(pid).ToNot(Equal(0)) Expect(inspectOut[0].HostConfig.CgroupParent).To(Equal("")) ctrCgroupsBytes, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/cgroup", pid)) - Expect(err).To(BeNil()) - var ctrCgroups string = string(ctrCgroupsBytes) + Expect(err).ShouldNot(HaveOccurred()) + var ctrCgroups = string(ctrCgroupsBytes) fmt.Printf("Output\n:%s\n", ctrCgroups) - Expect(curCgroups).To(Equal(ctrCgroups)) + Expect(ctrCgroups).To(Equal(curCgroups)) }) It("podman run with cgroups=enabled makes cgroups", func() { |