From 149481a57184becf3e9be329d253602654414118 Mon Sep 17 00:00:00 2001 From: haircommander Date: Mon, 20 Aug 2018 18:24:35 -0400 Subject: Fixed segfault in stats where container had netNS none or from container Signed-off-by: haircommander Closes: #1306 Approved by: rhatdan --- test/e2e/stats_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test/e2e') diff --git a/test/e2e/stats_test.go b/test/e2e/stats_test.go index ad40cbe5a..8096f58b2 100644 --- a/test/e2e/stats_test.go +++ b/test/e2e/stats_test.go @@ -90,4 +90,27 @@ var _ = Describe("Podman stats", func() { Expect(session.IsJSONOutputValid()).To(BeTrue()) }) + It("podman stats on a container with no net ns", func() { + session := podmanTest.Podman([]string{"run", "-d", "--net", "none", ALPINE, "top"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + session = podmanTest.Podman([]string{"stats", "--no-stream", "-a"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + }) + + It("podman stats on a container that joined another's net ns", func() { + session := podmanTest.RunTopContainer("") + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + cid := session.OutputToString() + + session = podmanTest.Podman([]string{"run", "-d", "--net", fmt.Sprintf("container:%s", cid), ALPINE, "top"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"stats", "--no-stream", "-a"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + }) }) -- cgit v1.2.3-54-g00ecf