Skip to content

Commit 759cb43

Browse files
committed
review commit 1 - to be squashed
1 parent cfe083c commit 759cb43

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

tests/e2e/customsuites/mountoptions.go

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -608,23 +608,10 @@ func (t *s3CSIMountOptionsTestSuite) DefineTests(driver storageframework.TestDri
608608
// List objects in the bucket to verify the object was created under the prefix
609609
ginkgo.By(fmt.Sprintf("Verifying object exists under prefix %s in bucket", prefix))
610610

611-
prefixListOutput, err := s3Client.ListObjectsWithPrefix(ctx, bucketName, prefix)
612-
framework.ExpectNoError(err, "Failed to list objects with prefix")
613-
614-
// Verify object exists under the prefix
615-
foundObjectUnderPrefix := false
616-
expectedKey := prefix + testFileName
617-
for _, obj := range prefixListOutput.Contents {
618-
if *obj.Key == expectedKey {
619-
foundObjectUnderPrefix = true
620-
break
621-
}
622-
}
623-
if !foundObjectUnderPrefix {
624-
framework.Failf("Object %s not found under prefix %s in bucket %s", testFileName, prefix, bucketName)
625-
} else {
626-
framework.Logf("Successfully found object %s under prefix %s in bucket %s", testFileName, prefix, bucketName)
627-
}
611+
// Use s3client's VerifyObjectsExistInS3 method instead of manual listing and checking
612+
err = s3Client.VerifyObjectsExistInS3(ctx, bucketName, prefix, []string{testFileName})
613+
framework.ExpectNoError(err, "Failed to verify object exists under prefix %s", prefix)
614+
framework.Logf("Successfully found object %s under prefix %s in bucket %s", testFileName, prefix, bucketName)
628615

629616
// List objects in the bucket without the prefix to verify no objects exist at the root
630617
ginkgo.By("Verifying no objects exist at the root of the bucket")

0 commit comments

Comments
 (0)