@@ -5,7 +5,9 @@ package integration
55import (
66 "encoding/json"
77 "fmt"
8+ "sort"
89 "strconv"
10+ "strings"
911 "sync"
1012 "time"
1113
@@ -27,6 +29,8 @@ var _ = Describe("Podman events", func() {
2729 _ , ec , _ := podmanTest .RunLsContainer ("" )
2830 Expect (ec ).To (Equal (0 ))
2931 result := podmanTest .Podman ([]string {"events" , "--stream=false" })
32+ fmt .Println ("test" )
33+ fmt .Println (result )
3034 result .WaitWithDefaultTimeout ()
3135 Expect (result ).Should (ExitCleanly ())
3236 })
@@ -309,4 +313,52 @@ var _ = Describe("Podman events", func() {
309313 Expect (result .OutputToStringArray ()).ToNot (BeEmpty (), "Number of health_status events" )
310314 })
311315
316+ It ("podman events artifacts" , func () {
317+ lock , port , err := setupRegistry (nil )
318+ Expect (err ).ToNot (HaveOccurred ())
319+ defer lock .Unlock ()
320+
321+ artifactFile , err := createArtifactFile (4192 )
322+ Expect (err ).ToNot (HaveOccurred ())
323+ artifactName := fmt .Sprintf ("localhost:%s/test/artifact1" , port )
324+
325+ podmanTest .PodmanExitCleanly ("artifact" , "add" , artifactName , artifactFile )
326+
327+ podmanTest .PodmanExitCleanly ("artifact" , "extract" , artifactName , artifactFile )
328+
329+ podmanTest .PodmanExitCleanly ("artifact" , "push" , "-q" , "--tls-verify=false" , artifactName )
330+
331+ podmanTest .PodmanExitCleanly ("artifact" , "remove" , artifactName )
332+
333+ podmanTest .PodmanExitCleanly ("artifact" , "pull" , "--tls-verify=false" , artifactName )
334+
335+ result := podmanTest .PodmanExitCleanly ("events" , "--stream=false" , "--filter" , "type=artifact" )
336+ events := result .OutputToStringArray ()
337+
338+ // sort for remote
339+ sort .Slice (events , func (i , j int ) bool {
340+ getStatus := func (log string ) string {
341+ status := strings .Fields (log )
342+ return status [5 ]
343+ }
344+ return getStatus (events [i ]) < getStatus (events [j ])
345+ })
346+
347+ Expect (events ).To (HaveLen (5 ))
348+ Expect (events [0 ]).To (And (
349+ ContainSubstring ("artifact add" ),
350+ ContainSubstring (fmt .Sprintf ("(name=%s, files=%s)" , artifactName , "1" ))))
351+ Expect (events [1 ]).To (And (
352+ ContainSubstring ("artifact extract" ),
353+ ContainSubstring (fmt .Sprintf ("(name=%s, target=%s)" , artifactName , artifactFile ))))
354+ Expect (events [2 ]).To (And (
355+ ContainSubstring ("artifact pull" ),
356+ ContainSubstring (fmt .Sprintf ("(name=%s)" , artifactName ))))
357+ Expect (events [3 ]).To (And (
358+ ContainSubstring ("artifact push" ),
359+ ContainSubstring (fmt .Sprintf ("(name=%s)" , artifactName ))))
360+ Expect (events [4 ]).To (And (
361+ ContainSubstring ("artifact remove" ),
362+ ContainSubstring (fmt .Sprintf ("(name=%s)" , artifactName ))))
363+ })
312364})
0 commit comments