Skip to content

Find, verify, and analyze leaked credentials

Fix failing TestGHCRListImages test in CI (#5368)

Muneeb Ullah Khana3fcdde40d1d
diff --git a/pkg/sources/docker/registries_test.go b/pkg/sources/docker/registries_test.go
index f6f3c0404..b661b80e9 100644
--- a/pkg/sources/docker/registries_test.go
+++ b/pkg/sources/docker/registries_test.go
@@ -57,9 +57,10 @@ func TestGHCRListImages(t *testing.T) {
ghcrImages, err := ghcr.ListImages(context.Background(), "ghcr.io/mongodb")
assert.NoError(t, err)
- assert.Equal(t, len(ghcrImages), 1)
-
- assert.Equal(t, ghcrImages, []string{"ghcr.io/mongodb/kingfisher"})
+ // mongodb is a third-party namespace whose package list changes over time,
+ // so only assert on a known package rather than the exact set.
+ assert.NotEmpty(t, ghcrImages)
+ assert.Contains(t, ghcrImages, "ghcr.io/mongodb/kingfisher")
}
func TestDockerHubListImages_RateLimitError(t *testing.T) {