Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

adjust test

chrisluf4f2718ba05b
diff --git a/test/s3/retention/s3_bucket_delete_with_lock_test.go b/test/s3/retention/s3_bucket_delete_with_lock_test.go
index 3a91f03693..271855f31a 100644
--- a/test/s3/retention/s3_bucket_delete_with_lock_test.go
+++ b/test/s3/retention/s3_bucket_delete_with_lock_test.go
@@ -27,22 +27,32 @@ func TestBucketDeletionWithObjectLock(t *testing.T) {
retentionTestCases := []struct {
name string
lockMode types.ObjectLockMode
+ key string
+ content string
}{
- {name: "ComplianceRetention", lockMode: types.ObjectLockModeCompliance},
- {name: "GovernanceRetention", lockMode: types.ObjectLockModeGovernance},
+ {
+ name: "ComplianceRetention",
+ lockMode: types.ObjectLockModeCompliance,
+ key: "test-compliance-retention",
+ content: "test content for compliance retention",
+ },
+ {
+ name: "GovernanceRetention",
+ lockMode: types.ObjectLockModeGovernance,
+ key: "test-governance-retention",
+ content: "test content for governance retention",
+ },
}
for _, tc := range retentionTestCases {
t.Run(fmt.Sprintf("CannotDeleteBucketWith%s", tc.name), func(t *testing.T) {
- key := fmt.Sprintf("test-%s", strings.ToLower(strings.ReplaceAll(tc.name, "Retention", "-retention")))
- content := fmt.Sprintf("test content for %s", strings.ToLower(tc.name))
retainUntilDate := time.Now().Add(10 * time.Second) // 10 seconds in future
// Upload object with retention
_, err := client.PutObject(context.Background(), &s3.PutObjectInput{
Bucket: aws.String(bucketName),
- Key: aws.String(key),
- Body: strings.NewReader(content),
+ Key: aws.String(tc.key),
+ Body: strings.NewReader(tc.content),
ObjectLockMode: tc.lockMode,
ObjectLockRetainUntilDate: aws.Time(retainUntilDate),
})
@@ -63,7 +73,7 @@ func TestBucketDeletionWithObjectLock(t *testing.T) {
// Delete the object
_, err = client.DeleteObject(context.Background(), &s3.DeleteObjectInput{
Bucket: aws.String(bucketName),
- Key: aws.String(key),
+ Key: aws.String(tc.key),
})
require.NoError(t, err, "DeleteObject should succeed after retention expires")