mirror of
https://github.com/versity/versitygw.git
synced 2026-09-19 14:34:19 +00:00
fix: Added VersioningNotConfigured error in Put/GetBucketVersioning acitons
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user