2 files changed,
+7
−0
internal/awsmanaged/storage.go
+1 −0
internal/awsmanaged/storage_test.go
+6 −0
| index fee899674..da47174fb 100644 |
| --- a/internal/awsmanaged/storage.go |
| +++ b/internal/awsmanaged/storage.go |
| @@ -428,6 +428,7 @@ func fleetLifecycleRule() s3types.LifecycleRule { |
| // S3 reads it back (an empty filter may come back with or without Prefix). |
| func isFleetLifecycleRule(r s3types.LifecycleRule) bool { |
| f := r.Filter |
| + //lint:ignore SA1019 S3 can still return a rule scoped by the legacy Prefix, and such a rule does not cover the whole bucket |
| return aws.ToString(r.ID) == lifecycleRuleID && r.Status == s3types.ExpirationStatusEnabled && r.Prefix == nil && |
| f != nil && f.And == nil && f.Tag == nil && f.ObjectSizeGreaterThan == nil && f.ObjectSizeLessThan == nil && aws.ToString(f.Prefix) == "" && |
| r.Expiration == nil && len(r.Transitions) == 0 && len(r.NoncurrentVersionTransitions) == 0 && |
| index 85d9c1108..b56b46bb4 100644 |
| --- a/internal/awsmanaged/storage_test.go |
| +++ b/internal/awsmanaged/storage_test.go |
| @@ -550,6 +550,12 @@ func TestAWSFleetBucketContract(t *testing.T) { |
| r.NoncurrentVersionExpiration = &s3types.NoncurrentVersionExpiration{NoncurrentDays: aws.Int32(30)} |
| w.buckets[b] = &fakeBucket{region: testRegion, owner: testAccount, tags: ownTags(testFleet), rules: []s3types.LifecycleRule{r}} |
| }}, |
| + "our rule scoped by the legacy top-level prefix": {testRegion, func(w *fakeS3World, b string) { |
| + r := fleetLifecycleRule() |
| + //lint:ignore SA1019 S3 can still return this field, and the rule that sets it is not ours |
| + r.Prefix = aws.String("logs/") |
| + w.buckets[b] = &fakeBucket{region: testRegion, owner: testAccount, tags: ownTags(testFleet), rules: []s3types.LifecycleRule{r}} |
| + }}, |
| "our rule plus another": {testRegion, func(w *fakeS3World, b string) { |
| w.buckets[b] = &fakeBucket{region: testRegion, owner: testAccount, tags: ownTags(testFleet), rules: []s3types.LifecycleRule{fleetLifecycleRule(), |
| {ID: aws.String("x"), Status: s3types.ExpirationStatusDisabled, Filter: &s3types.LifecycleRuleFilter{}}}} |