hs-test: ignore images with no repo tags when creating containers 04/42904/2
authorSemir Sionek <[email protected]>
Mon, 28 Apr 2025 10:22:57 +0000 (06:22 -0400)
committerFlorin Coras <[email protected]>
Mon, 28 Apr 2025 16:22:37 +0000 (16:22 +0000)
While iterating over images available in the system, the user might
have some images with no repo tags, which make hs-test panic when trying
to create containers. Make sure that we have repo tags to read from
before trying to do that.

Type: fix
Change-Id: Ibeaf5ac2685b191fcf258455b98f3165c202a319
Signed-off-by: Semir Sionek <[email protected]>
extras/hs-test/infra/container.go

index efc317f..5035827 100644 (file)
@@ -172,6 +172,9 @@ func (c *Container) Create() error {
        c.Suite.AssertNil(err)
 
        for _, image := range images {
+               if len(image.RepoTags) == 0 {
+                       continue
+               }
                sliceOfImageNames = append(sliceOfImageNames, strings.Split(image.RepoTags[0], ":")[0])
        }
        if !slices.Contains(sliceOfImageNames, c.Image) {