forked from TrueCloudLab/frostfs-s3-gw
[#604] Add MFADelete tests with reworked mfa.Storage implementation
Signed-off-by: Alex Vanin <a.vanin@yadro.com> Signed-off-by: Pavel Pogodaev <p.pogodaev@yadro.com>
This commit is contained in:
parent
0fc56cbfce
commit
7d6e20fdad
17 changed files with 440 additions and 233 deletions
|
@ -521,6 +521,42 @@ func TestPutBucketLifecycleInvalidXML(t *testing.T) {
|
|||
assertS3Error(hc.t, w, apierr.GetAPIError(apierr.ErrMalformedXML))
|
||||
}
|
||||
|
||||
func TestPutMFADeleteWithLifecycleBucket(t *testing.T) {
|
||||
hc := prepareHandlerContext(t)
|
||||
lifecycle := &data.LifecycleConfiguration{
|
||||
Rules: []data.LifecycleRule{
|
||||
{
|
||||
Status: data.LifecycleStatusEnabled,
|
||||
Expiration: &data.LifecycleExpiration{
|
||||
Days: ptr(21),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// S3 Lifecycle configuration on multi-factor authentication (MFA)-enabled buckets isn't supported.
|
||||
t.Run("lifecycle in MFA Delete bucket", func(_ *testing.T) {
|
||||
bktName := "mfa-delete-bucket"
|
||||
deviceName := "device"
|
||||
createBucket(hc, bktName)
|
||||
key := createMFADevice(hc, bktName, deviceName)
|
||||
|
||||
putBucketVersioningMFADelete(hc, bktName, "Enabled", "Enabled", generateMFAHeader(key, deviceName))
|
||||
putBucketLifecycleConfigurationErr(hc, bktName, lifecycle, nil, apierr.GetAPIError(apierr.ErrCannotPutLifecycleConfiguration))
|
||||
})
|
||||
|
||||
// You cannot use MFA delete with lifecycle configurations.
|
||||
t.Run("MFA Delete in lifecycle bucket", func(_ *testing.T) {
|
||||
bktName := "lifecycle-bucket"
|
||||
deviceName := "device2"
|
||||
createBucket(hc, bktName)
|
||||
key := createMFADevice(hc, bktName, deviceName)
|
||||
|
||||
putBucketLifecycleConfiguration(hc, bktName, lifecycle, nil, false)
|
||||
putBucketVersioningMFADeleteErr(hc, bktName, "Enabled", "Enabled", generateMFAHeader(key, deviceName), apierr.GetAPIError(apierr.ErrMFAAuthIsNotSupported))
|
||||
})
|
||||
}
|
||||
|
||||
func TestPutBucketLifecycleCopiesNumbers(t *testing.T) {
|
||||
t.Run("with lifecycle container", func(t *testing.T) {
|
||||
hc := prepareHandlerContext(t)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue