@@ -222,6 +222,36 @@ var _ = Describe("Podman events", func() {
222222 Expect (result2 .OutputToString ()).To (ContainSubstring (fmt .Sprintf ("pod_id=%s" , id )))
223223 })
224224
225+ It ("podman events network connection" , func () {
226+ network := stringid .GenerateRandomID ()
227+ result := podmanTest .Podman ([]string {"create" , "--network" , "bridge" , ALPINE , "top" })
228+ result .WaitWithDefaultTimeout ()
229+ Expect (result ).Should (ExitCleanly ())
230+ ctrID := result .OutputToString ()
231+
232+ result = podmanTest .Podman ([]string {"network" , "create" , network })
233+ result .WaitWithDefaultTimeout ()
234+ Expect (result ).Should (ExitCleanly ())
235+
236+ result = podmanTest .Podman ([]string {"network" , "connect" , network , ctrID })
237+ result .WaitWithDefaultTimeout ()
238+ Expect (result ).Should (ExitCleanly ())
239+
240+ result = podmanTest .Podman ([]string {"network" , "disconnect" , network , ctrID })
241+ result .WaitWithDefaultTimeout ()
242+ Expect (result ).Should (ExitCleanly ())
243+
244+ result = podmanTest .Podman ([]string {"events" , "--stream=false" , "--since" , "30s" })
245+ result .WaitWithDefaultTimeout ()
246+ Expect (result ).Should (ExitCleanly ())
247+ lines := result .OutputToStringArray ()
248+ Expect (lines ).To (HaveLen (5 ))
249+ Expect (lines [3 ]).To (ContainSubstring ("network connect" ))
250+ Expect (lines [3 ]).To (ContainSubstring (fmt .Sprintf ("(container=%s, name=%s)" , ctrID , network )))
251+ Expect (lines [4 ]).To (ContainSubstring ("network disconnect" ))
252+ Expect (lines [4 ]).To (ContainSubstring (fmt .Sprintf ("(container=%s, name=%s)" , ctrID , network )))
253+ })
254+
225255 It ("podman events health_status generated" , func () {
226256 session := podmanTest .Podman ([]string {"run" , "--name" , "test-hc" , "-dt" , "--health-cmd" , "echo working" , "busybox" })
227257 session .WaitWithDefaultTimeout ()
0 commit comments