Skip to content

Commit

Permalink
testsuite/server: add test for unversioned bucket lock config
Browse files Browse the repository at this point in the history
Change-Id: I57dbcad9a4ddf640fbfd873ede9ba1e65936d7af
  • Loading branch information
halkyon committed Nov 21, 2024
1 parent dbcccfa commit eefd411
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions testsuite/server/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ func TestObjectLock(t *testing.T) {
Satellite: func(log *zap.Logger, index int, config *satellite.Config) {
config.Metainfo.ObjectLockEnabled = true
config.Metainfo.UseBucketLevelObjectVersioning = true
config.Metainfo.ProjectLimits.MaxBuckets = 100
},
Uplink: func(log *zap.Logger, index int, config *testplanet.UplinkConfig) {
config.APIKeyVersion = macaroon.APIKeyVersionObjectLock
Expand Down Expand Up @@ -330,6 +331,22 @@ func TestObjectLock(t *testing.T) {
requireS3Error(t, deleteObject(ctx, client, lockBucket, objKey1, *putObjResp.VersionId), http.StatusForbidden, "AccessDenied")
})

t.Run("put object lock config on unversioned bucket not allowed", func(t *testing.T) {
bucket := testrand.BucketName()
require.NoError(t, createBucket(ctx, client, bucket, false, false))

retDays := int64(5)
retMode := s3.ObjectLockRetentionModeCompliance

_, err := putObjectLockConfiguration(ctx, client, bucket, "Enabled", &s3.ObjectLockRule{
DefaultRetention: &s3.DefaultRetention{
Days: &retDays,
Mode: &retMode,
},
})
requireS3Error(t, err, http.StatusConflict, "InvalidBucketState")
})

t.Run("put object with lock not allowed on unversioned bucket", func(t *testing.T) {
noVersioningBucket := testrand.BucketName()
require.NoError(t, createBucket(ctx, client, noVersioningBucket, false, false))
Expand Down

0 comments on commit eefd411

Please sign in to comment.