From aed0730e8270dcb27a29a0724879e33daaf92f1b Mon Sep 17 00:00:00 2001 From: williamlardier Date: Fri, 29 Nov 2024 16:44:09 +0100 Subject: [PATCH] Test that negative inflights do not allow to bypass the quota Issue: ZENKO-4941 --- tests/ctst/features/quotas/Quotas.feature | 48 ++++++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/tests/ctst/features/quotas/Quotas.feature b/tests/ctst/features/quotas/Quotas.feature index 8fca68a8c..a61b6cf9a 100644 --- a/tests/ctst/features/quotas/Quotas.feature +++ b/tests/ctst/features/quotas/Quotas.feature @@ -107,8 +107,8 @@ Feature: Quota Management for APIs Given an action "DeleteObject" And a permission to perform the "PutObject" action And a STORAGE_MANAGER type - And a bucket quota set to 10000 B - And an account quota set to 10000 B + And a bucket quota set to 1000 B + And an account quota set to 1000 B And an upload size of 1000 B for the object "obj-1" And a bucket quota set to B And an account quota set to B @@ -119,11 +119,13 @@ Feature: Quota Management for APIs And I PUT an object with size Then the API should "fail" with "QuotaExceeded" When the "count-items" cronjobs completes without error + # Wait for inflights to be read by SCUBA When I wait 3 seconds # At this point if negative inflights are not supported, write should # not be possible, as the previous inflights are now part of the current # metrics. And i delete object "obj-1" + # Wait for inflights to be read by SCUBA And I wait 3 seconds And I PUT an object with size Then the API should "succeed" with "" @@ -136,3 +138,45 @@ Feature: Quota Management for APIs | 100 | 200 | 0 | IAM_USER | | 100 | 0 | 200 | IAM_USER | | 100 | 200 | 200 | IAM_USER | + + @2.6.0 + @PreMerge + @Quotas + @CronJob + @DataDeletion + @NonVersioned + Scenario Outline: Negative inflights do not allow to bypass the quota + Given an action "DeleteObject" + And a permission to perform the "PutObject" action + And a STORAGE_MANAGER type + And a bucket quota set to 1000 B + And an account quota set to 1000 B + And an upload size of 1000 B for the object "obj-1" + And a bucket quota set to B + And an account quota set to B + And a type + And an environment setup for the API + And an "existing" IAM Policy that "applies" with "ALLOW" effect for the current API + When I wait 3 seconds + And I PUT an object with size + Then the API should "fail" with "QuotaExceeded" + When the "count-items" cronjobs completes without error + # Wait for inflights to be read by SCUBA + When I wait 3 seconds + # At this point if negative inflights are not supported, write should + # not be possible, as the previous inflights are now part of the current + # metrics. + And i delete object "obj-1" + # Wait for inflights to be read by SCUBA + And I wait 3 seconds + And I PUT an object with size 1000 + Then the API should "fail" with "QuotaExceeded" + + Examples: + | uploadSize | bucketQuota | accountQuota | userType | + | 100 | 200 | 0 | ACCOUNT | + | 100 | 0 | 200 | ACCOUNT | + | 100 | 200 | 200 | ACCOUNT | + | 100 | 200 | 0 | IAM_USER | + | 100 | 0 | 200 | IAM_USER | + | 100 | 200 | 200 | IAM_USER | \ No newline at end of file