aboutsummaryrefslogtreecommitdiff
path: root/test/s3/versioning/s3_versioning_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/s3/versioning/s3_versioning_test.go')
-rw-r--r--test/s3/versioning/s3_versioning_test.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/s3/versioning/s3_versioning_test.go b/test/s3/versioning/s3_versioning_test.go
index 79f027748..cb8d72535 100644
--- a/test/s3/versioning/s3_versioning_test.go
+++ b/test/s3/versioning/s3_versioning_test.go
@@ -164,6 +164,16 @@ func checkVersioningStatus(t *testing.T, client *s3.Client, bucketName string, e
assert.Equal(t, expectedStatus, resp.Status)
}
+// checkVersioningStatusEmpty verifies that a bucket has no versioning configuration (newly created bucket)
+func checkVersioningStatusEmpty(t *testing.T, client *s3.Client, bucketName string) {
+ resp, err := client.GetBucketVersioning(context.TODO(), &s3.GetBucketVersioningInput{
+ Bucket: aws.String(bucketName),
+ })
+ require.NoError(t, err)
+ // AWS S3 returns an empty versioning configuration (no Status field) for buckets that have never had versioning configured, such as newly created buckets.
+ assert.Empty(t, resp.Status, "Newly created bucket should have empty versioning status")
+}
+
// putObject puts an object into a bucket
func putObject(t *testing.T, client *s3.Client, bucketName, key, content string) *s3.PutObjectOutput {
resp, err := client.PutObject(context.TODO(), &s3.PutObjectInput{
@@ -284,8 +294,9 @@ func TestVersioningBasicWorkflow(t *testing.T) {
createBucket(t, client, bucketName)
defer deleteBucket(t, client, bucketName)
- // Initially, versioning should be suspended/disabled
- checkVersioningStatus(t, client, bucketName, types.BucketVersioningStatusSuspended)
+ // Initially, versioning should be unset/empty (not suspended) for newly created buckets
+ // This matches AWS S3 behavior where new buckets have no versioning status
+ checkVersioningStatusEmpty(t, client, bucketName)
// Enable versioning
enableVersioning(t, client, bucketName)