rbd: added rbd info to validateRBDImageCount func

Signed-off-by: Oded Viner <oviner@redhat.com>
This commit is contained in:
Oded Viner
2024-10-31 16:14:02 +02:00
committed by mergify[bot]
parent 98cf0780e1
commit dd1c302bd5
2 changed files with 47 additions and 14 deletions

View File

@ -189,12 +189,27 @@ func validateRBDImageCount(f *framework.Framework, count int, pool string) {
framework.Failf("failed to list rbd images: %v", err)
}
if len(imageList) != count {
var imageDetails []string // To collect details for all images
for _, image := range imageList {
imgInfoStr, err := getImageInfo(f, image, pool)
if err != nil {
framework.Logf("Error getting image info: %v", err)
}
imgStatusOutput, err := getImageStatus(f, image, pool)
if err != nil {
framework.Logf("Error getting image status: %v", err)
}
// Collecting image details for printing
imageDetails = append(imageDetails, fmt.Sprintf(
"Pool: %s, Image: %s, Info: %s, Status: %s", pool, image, imgInfoStr, imgStatusOutput))
}
framework.Failf(
"backend images not matching kubernetes resource count,image count %d kubernetes resource count %d"+
"\nbackend image Info:\n %v",
"\nbackend image Info:\n %v\n images information and status %v",
len(imageList),
count,
imageList)
imageList,
strings.Join(imageDetails, "\n"))
}
}