Show network name network events with podman -remote events

Fixes: https://github.com/containers/podman/issues/21311

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2024-01-29 09:49:28 -05:00
parent 22b1650619
commit c7910e75e3
2 changed files with 38 additions and 1 deletions

View File

@ -222,6 +222,36 @@ var _ = Describe("Podman events", func() {
Expect(result2.OutputToString()).To(ContainSubstring(fmt.Sprintf("pod_id=%s", id)))
})
It("podman events network connection", func() {
network := stringid.GenerateRandomID()
result := podmanTest.Podman([]string{"create", "--network", "bridge", ALPINE, "top"})
result.WaitWithDefaultTimeout()
Expect(result).Should(ExitCleanly())
ctrID := result.OutputToString()
result = podmanTest.Podman([]string{"network", "create", network})
result.WaitWithDefaultTimeout()
Expect(result).Should(ExitCleanly())
result = podmanTest.Podman([]string{"network", "connect", network, ctrID})
result.WaitWithDefaultTimeout()
Expect(result).Should(ExitCleanly())
result = podmanTest.Podman([]string{"network", "disconnect", network, ctrID})
result.WaitWithDefaultTimeout()
Expect(result).Should(ExitCleanly())
result = podmanTest.Podman([]string{"events", "--stream=false", "--since", "30s"})
result.WaitWithDefaultTimeout()
Expect(result).Should(ExitCleanly())
lines := result.OutputToStringArray()
Expect(lines).To(HaveLen(5))
Expect(lines[3]).To(ContainSubstring("network connect"))
Expect(lines[3]).To(ContainSubstring(fmt.Sprintf("(container=%s, name=%s)", ctrID, network)))
Expect(lines[4]).To(ContainSubstring("network disconnect"))
Expect(lines[4]).To(ContainSubstring(fmt.Sprintf("(container=%s, name=%s)", ctrID, network)))
})
It("podman events health_status generated", func() {
session := podmanTest.Podman([]string{"run", "--name", "test-hc", "-dt", "--health-cmd", "echo working", "busybox"})
session.WaitWithDefaultTimeout()