aboutsummaryrefslogtreecommitdiff
path: root/weed/s3api/s3api_object_retention_test.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2025-07-18 19:40:12 -0700
committerchrislu <chris.lu@gmail.com>2025-07-18 19:40:12 -0700
commit8121fdeec3139ec67004238126b389d40b929aa3 (patch)
tree4d32fa1b72d74987aad6ea2d078e251216bd8430 /weed/s3api/s3api_object_retention_test.go
parentf63f40a3d4bfdd5e4eea1350bd0e0d530c207ffb (diff)
downloadseaweedfs-8121fdeec3139ec67004238126b389d40b929aa3.tar.xz
seaweedfs-8121fdeec3139ec67004238126b389d40b929aa3.zip
fix many issues
Diffstat (limited to 'weed/s3api/s3api_object_retention_test.go')
-rw-r--r--weed/s3api/s3api_object_retention_test.go59
1 files changed, 36 insertions, 23 deletions
diff --git a/weed/s3api/s3api_object_retention_test.go b/weed/s3api/s3api_object_retention_test.go
index 0caa50b42..638d37d14 100644
--- a/weed/s3api/s3api_object_retention_test.go
+++ b/weed/s3api/s3api_object_retention_test.go
@@ -498,8 +498,9 @@ func TestValidateObjectLockConfiguration(t *testing.T) {
ObjectLockEnabled: "Enabled",
Rule: &ObjectLockRule{
DefaultRetention: &DefaultRetention{
- Mode: "GOVERNANCE",
- Days: 30,
+ Mode: "GOVERNANCE",
+ Days: 30,
+ DaysSet: true,
},
},
},
@@ -511,8 +512,9 @@ func TestValidateObjectLockConfiguration(t *testing.T) {
ObjectLockEnabled: "Enabled",
Rule: &ObjectLockRule{
DefaultRetention: &DefaultRetention{
- Mode: "COMPLIANCE",
- Years: 1,
+ Mode: "COMPLIANCE",
+ Years: 1,
+ YearsSet: true,
},
},
},
@@ -545,9 +547,11 @@ func TestValidateObjectLockConfiguration(t *testing.T) {
ObjectLockEnabled: "Enabled",
Rule: &ObjectLockRule{
DefaultRetention: &DefaultRetention{
- Mode: "GOVERNANCE",
- Days: 30,
- Years: 1,
+ Mode: "GOVERNANCE",
+ Days: 30,
+ Years: 1,
+ DaysSet: true,
+ YearsSet: true,
},
},
},
@@ -573,8 +577,9 @@ func TestValidateObjectLockConfiguration(t *testing.T) {
ObjectLockEnabled: "Enabled",
Rule: &ObjectLockRule{
DefaultRetention: &DefaultRetention{
- Mode: "INVALID_MODE",
- Days: 30,
+ Mode: "INVALID_MODE",
+ Days: 30,
+ DaysSet: true,
},
},
},
@@ -587,8 +592,9 @@ func TestValidateObjectLockConfiguration(t *testing.T) {
ObjectLockEnabled: "Enabled",
Rule: &ObjectLockRule{
DefaultRetention: &DefaultRetention{
- Mode: "GOVERNANCE",
- Days: 50000,
+ Mode: "GOVERNANCE",
+ Days: 50000,
+ DaysSet: true,
},
},
},
@@ -601,8 +607,9 @@ func TestValidateObjectLockConfiguration(t *testing.T) {
ObjectLockEnabled: "Enabled",
Rule: &ObjectLockRule{
DefaultRetention: &DefaultRetention{
- Mode: "GOVERNANCE",
- Years: 200,
+ Mode: "GOVERNANCE",
+ Years: 200,
+ YearsSet: true,
},
},
},
@@ -651,23 +658,26 @@ func TestValidateDefaultRetention(t *testing.T) {
{
name: "Valid retention with days",
retention: &DefaultRetention{
- Mode: "GOVERNANCE",
- Days: 30,
+ Mode: "GOVERNANCE",
+ Days: 30,
+ DaysSet: true,
},
expectError: false,
},
{
name: "Valid retention with years",
retention: &DefaultRetention{
- Mode: "COMPLIANCE",
- Years: 1,
+ Mode: "COMPLIANCE",
+ Years: 1,
+ YearsSet: true,
},
expectError: false,
},
{
name: "Missing mode",
retention: &DefaultRetention{
- Days: 30,
+ Days: 30,
+ DaysSet: true,
},
expectError: true,
errorMsg: "default retention must specify Mode",
@@ -675,8 +685,9 @@ func TestValidateDefaultRetention(t *testing.T) {
{
name: "Invalid mode",
retention: &DefaultRetention{
- Mode: "INVALID",
- Days: 30,
+ Mode: "INVALID",
+ Days: 30,
+ DaysSet: true,
},
expectError: true,
errorMsg: "invalid default retention mode",
@@ -684,9 +695,11 @@ func TestValidateDefaultRetention(t *testing.T) {
{
name: "Both days and years specified",
retention: &DefaultRetention{
- Mode: "GOVERNANCE",
- Days: 30,
- Years: 1,
+ Mode: "GOVERNANCE",
+ Days: 30,
+ Years: 1,
+ DaysSet: true,
+ YearsSet: true,
},
expectError: true,
errorMsg: "default retention cannot specify both Days and Years",