aboutsummaryrefslogtreecommitdiff
path: root/test/s3/retention/s3_retention_test.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2025-07-16 23:00:25 -0700
committerGitHub <noreply@github.com>2025-07-16 23:00:25 -0700
commita524b4f485ce5aa2f234c742bd7d1e75386f569b (patch)
tree794b343485e4adace63dc091703d2368f9075616 /test/s3/retention/s3_retention_test.go
parent89706d36dccc5d851ef6b818f0dd32249e6560a3 (diff)
downloadseaweedfs-a524b4f485ce5aa2f234c742bd7d1e75386f569b.tar.xz
seaweedfs-a524b4f485ce5aa2f234c742bd7d1e75386f569b.zip
Object locking need to persist the tags and set the headers (#6994)
* fix object locking read and write No logic to include object lock metadata in HEAD/GET response headers No logic to extract object lock metadata from PUT request headers * add tests for object locking * Update weed/s3api/s3api_object_handlers_put.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update weed/s3api/s3api_object_handlers.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * refactor * add unit tests * sync versions * Update s3_worm_integration_test.go * fix legal hold values * lint * fix tests * racing condition when enable versioning * fix tests * validate put object lock header * allow check lock permissions for PUT * default to OFF legal hold * only set object lock headers for objects that are actually from object lock-enabled buckets fix --- FAIL: TestAddObjectLockHeadersToResponse/Handle_entry_with_no_object_lock_metadata (0.00s) * address comments * fix tests * purge * fix * refactoring * address comment * address comment * Update weed/s3api/s3api_object_handlers_put.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update weed/s3api/s3api_object_handlers_put.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update weed/s3api/s3api_object_handlers.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * avoid nil * ensure locked objects cannot be overwritten --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Diffstat (limited to 'test/s3/retention/s3_retention_test.go')
-rw-r--r--test/s3/retention/s3_retention_test.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/s3/retention/s3_retention_test.go b/test/s3/retention/s3_retention_test.go
index f23f4ddd8..54eb12848 100644
--- a/test/s3/retention/s3_retention_test.go
+++ b/test/s3/retention/s3_retention_test.go
@@ -160,10 +160,10 @@ func deleteAllObjectVersions(t *testing.T, client *s3.Client, bucketName string)
if len(objectsToDelete) > 0 {
_, err := client.DeleteObjects(context.TODO(), &s3.DeleteObjectsInput{
Bucket: aws.String(bucketName),
- BypassGovernanceRetention: true,
+ BypassGovernanceRetention: aws.Bool(true),
Delete: &types.Delete{
Objects: objectsToDelete,
- Quiet: true,
+ Quiet: aws.Bool(true),
},
})
if err != nil {
@@ -174,7 +174,7 @@ func deleteAllObjectVersions(t *testing.T, client *s3.Client, bucketName string)
Bucket: aws.String(bucketName),
Key: obj.Key,
VersionId: obj.VersionId,
- BypassGovernanceRetention: true,
+ BypassGovernanceRetention: aws.Bool(true),
})
if delErr != nil {
t.Logf("Warning: failed to delete object %s@%s: %v", *obj.Key, *obj.VersionId, delErr)
@@ -277,7 +277,7 @@ func TestBasicRetentionWorkflow(t *testing.T) {
_, err = client.DeleteObject(context.TODO(), &s3.DeleteObjectInput{
Bucket: aws.String(bucketName),
Key: aws.String(key),
- BypassGovernanceRetention: true,
+ BypassGovernanceRetention: aws.Bool(true),
})
require.NoError(t, err)
}
@@ -322,7 +322,7 @@ func TestRetentionModeCompliance(t *testing.T) {
_, err = client.DeleteObject(context.TODO(), &s3.DeleteObjectInput{
Bucket: aws.String(bucketName),
Key: aws.String(key),
- BypassGovernanceRetention: true,
+ BypassGovernanceRetention: aws.Bool(true),
})
require.Error(t, err)
@@ -420,7 +420,7 @@ func TestObjectLockConfiguration(t *testing.T) {
Rule: &types.ObjectLockRule{
DefaultRetention: &types.DefaultRetention{
Mode: types.ObjectLockRetentionModeGovernance,
- Days: 30,
+ Days: aws.Int32(30),
},
},
},
@@ -513,7 +513,7 @@ func TestRetentionWithVersions(t *testing.T) {
Bucket: aws.String(bucketName),
Key: aws.String(key),
VersionId: putResp1.VersionId,
- BypassGovernanceRetention: true,
+ BypassGovernanceRetention: aws.Bool(true),
})
require.NoError(t, err)
}
@@ -562,7 +562,7 @@ func TestRetentionAndLegalHoldCombination(t *testing.T) {
_, err = client.DeleteObject(context.TODO(), &s3.DeleteObjectInput{
Bucket: aws.String(bucketName),
Key: aws.String(key),
- BypassGovernanceRetention: true,
+ BypassGovernanceRetention: aws.Bool(true),
})
require.Error(t, err)
@@ -580,7 +580,7 @@ func TestRetentionAndLegalHoldCombination(t *testing.T) {
_, err = client.DeleteObject(context.TODO(), &s3.DeleteObjectInput{
Bucket: aws.String(bucketName),
Key: aws.String(key),
- BypassGovernanceRetention: true,
+ BypassGovernanceRetention: aws.Bool(true),
})
require.NoError(t, err)
}