Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 11 additions & 29 deletions test/extended/cli/mustgather.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,35 +605,17 @@ var _ = g.Describe("[sig-cli] oc adm must-gather", func() {
// Check if gather.logs exists in the directory for default must-gather image
checkGatherLogsForImage(tempDir)

// Check if gather.logs exists in the directory for CNV image
// Note: registry.redhat.io may not be accessible in CI environments, so we skip if the image pull fails
err = oc.AsAdmin().WithoutNamespace().Run("adm").Args("must-gather", "--image=registry.redhat.io/container-native-virtualization/cnv-must-gather-rhel9:v4.15.0", "--dest-dir="+tempDir1).Execute()
if err != nil {
errMsg := err.Error()
isPullError := strings.Contains(errMsg, "pull") && (strings.Contains(errMsg, "manifest unknown") || strings.Contains(errMsg, "not found"))
if isPullError {
e2e.Logf("Skipping CNV must-gather image test - image pull failed (likely not accessible in CI environment): %v", err)
} else {
o.Expect(err).NotTo(o.HaveOccurred(), "must-gather failed with non-pull error")
}
} else {
checkGatherLogsForImage(tempDir1)
}

// Check if gather.logs exists for both the images when passed to must-gather
// Note: registry.redhat.io may not be accessible in CI environments, so we skip if the image pull fails
err = oc.AsAdmin().WithoutNamespace().Run("adm").Args("must-gather", "--image-stream=openshift/must-gather", "--image=registry.redhat.io/container-native-virtualization/cnv-must-gather-rhel9:v4.15.0", "--dest-dir="+tempDir2).Execute()
if err != nil {
errMsg := err.Error()
isPullError := strings.Contains(errMsg, "pull") && (strings.Contains(errMsg, "manifest unknown") || strings.Contains(errMsg, "not found"))
if isPullError {
e2e.Logf("Skipping multi-image must-gather test with CNV - image pull failed (likely not accessible in CI environment): %v", err)
} else {
o.Expect(err).NotTo(o.HaveOccurred(), "must-gather failed with non-pull error")
}
} else {
checkGatherLogsForImage(tempDir2)
}
// Check if gather.logs exists in the directory when using --image-stream
// Use the CI-accessible openshift/must-gather imagestream instead of external registry images
err = oc.AsAdmin().WithoutNamespace().Run("adm").Args("must-gather", "--image-stream=openshift/must-gather", "--dest-dir="+tempDir1).Execute()
o.Expect(err).NotTo(o.HaveOccurred(), "must-gather with imagestream should succeed")
checkGatherLogsForImage(tempDir1)

// Check if gather.logs exists for multiple imagestreams when passed to must-gather
// This tests the multi-image functionality using CI-accessible imagestreams
err = oc.AsAdmin().WithoutNamespace().Run("adm").Args("must-gather", "--image-stream=openshift/must-gather", "--image-stream=openshift/must-gather", "--dest-dir="+tempDir2).Execute()
o.Expect(err).NotTo(o.HaveOccurred(), "must-gather with multiple imagestreams should succeed")
checkGatherLogsForImage(tempDir2)
})
})

Expand Down