fix: Added VersioningNotConfigured error in Put/GetBucketVersioning acitons

This commit is contained in:
jonaustin09
2024-10-04 20:52:31 -04:00
parent d4fdbdd113
commit 768983be34
6 changed files with 102 additions and 12 deletions
+9
View File
@@ -490,6 +490,10 @@ func TestPosix(s *S3Conf) {
PutObject_name_too_long(s)
HeadObject_name_too_long(s)
DeleteObject_name_too_long(s)
// posix specific versioning tests
if !s.versioningEnabled {
TestVersioningDisabled(s)
}
}
func TestIAM(s *S3Conf) {
@@ -571,6 +575,11 @@ func TestVersioning(s *S3Conf) {
Versioning_WORM_obj_version_locked_with_compliance_retention(s)
}
func TestVersioningDisabled(s *S3Conf) {
VersioningDisabled_GetBucketVersioning_not_configured(s)
VersioningDisabled_PutBucketVersioning_not_configured(s)
}
type IntTests map[string]func(s *S3Conf) error
func GetIntTests() IntTests {
+34
View File
@@ -12170,3 +12170,37 @@ func Versioning_WORM_obj_version_locked_with_compliance_retention(s *S3Conf) err
return nil
}, withLock(), withVersioning())
}
func VersioningDisabled_GetBucketVersioning_not_configured(s *S3Conf) error {
testName := "VersioningDisabled_GetBucketVersioning_not_configured"
return actionHandler(s, testName, func(s3client *s3.Client, bucket string) error {
ctx, cancel := context.WithTimeout(context.Background(), shortTimeout)
_, err := s3client.PutBucketVersioning(ctx, &s3.PutBucketVersioningInput{
Bucket: &bucket,
VersioningConfiguration: &types.VersioningConfiguration{
Status: types.BucketVersioningStatusEnabled,
},
})
cancel()
if err := checkApiErr(err, s3err.GetAPIError(s3err.ErrVersioningNotConfigured)); err != nil {
return err
}
return nil
})
}
func VersioningDisabled_PutBucketVersioning_not_configured(s *S3Conf) error {
testName := "VersioningDisabled_PutBucketVersioning_not_configured"
return actionHandler(s, testName, func(s3client *s3.Client, bucket string) error {
ctx, cancel := context.WithTimeout(context.Background(), shortTimeout)
_, err := s3client.GetBucketVersioning(ctx, &s3.GetBucketVersioningInput{
Bucket: &bucket,
})
cancel()
if err := checkApiErr(err, s3err.GetAPIError(s3err.ErrVersioningNotConfigured)); err != nil {
return err
}
return nil
})
}