Skip to content

Commit

Permalink
Improve test stability
Browse files Browse the repository at this point in the history
- Ensure no scenario requiring count items to run at the same
  time, as they were overriding each other: if count items
  completes between 2 checks of a quota scenario, the "current"
  may be cleaned, leading to wrong test results.
- Incerase the count items lock stale duration: if we have
  too many buckets, we might fail to get the lock in time.
- Put the count items scenario in a dedicated folder, as it
  is not related to quotas.

Issue: ZENKO-4941
  • Loading branch information
williamlardier committed Dec 4, 2024
1 parent 22d65a2 commit 29a7622
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 23 deletions.
2 changes: 1 addition & 1 deletion tests/ctst/common/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { cleanS3Bucket } from './common';
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

const { atMostOnePicklePerTag } = parallelCanAssignHelpers;
const noParallelRun = atMostOnePicklePerTag(['@AfterAll', '@PRA', '@ColdStorage']);
const noParallelRun = atMostOnePicklePerTag(['@AfterAll', '@PRA', '@ColdStorage', '@Utilization']);

setParallelCanAssign(noParallelRun);

Expand Down
30 changes: 13 additions & 17 deletions tests/ctst/features/quotas/Quotas.feature
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Feature: Quota Management for APIs
@CronJob
@DataDeletion
@NonVersioned
@Utilization
Scenario Outline: Quotas are affected by deletion operations
Given an action "DeleteObject"
And a permission to perform the "PutObject" action
Expand Down Expand Up @@ -103,6 +104,7 @@ Feature: Quota Management for APIs
@CronJob
@DataDeletion
@NonVersioned
@Utilization
Scenario Outline: Quotas are affected by deletion operations between count items runs
Given an action "DeleteObject"
And a permission to perform the "PutObject" action
Expand Down Expand Up @@ -133,11 +135,6 @@ Feature: Quota Management for APIs
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 |

@2.6.0
@PreMerge
Expand All @@ -149,34 +146,33 @@ 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 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 <bucketQuota> B
And a bucket quota set to <uploadSize> B
And an account quota set to <accountQuota> B
# Quota is 200: we put an object of 200 B
And an upload size of <bucketQuota> B for the object "obj-1"
And a <userType> 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
# Quota is 200, inflight are 200, we should not be able to write
And I PUT an object with size <uploadSize>
Then the API should "fail" with "QuotaExceeded"
# The inflights are now part of the current metrics
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.
# Delete 200 B, inflights are now -200
# With 200 "current" bytes, we should accept up to 200 B (200 - 200 + input <= quota)
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
And I wait 6- seconds
# Try to write 300
And I PUT an object with size 300
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 |
| 200 | 200 | 0 | ACCOUNT |
9 changes: 4 additions & 5 deletions tests/ctst/steps/utils/kubernetes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,11 @@ export async function createJobAndWaitForCompletion(

try {
releaseLock = await lockFile.lock(lockFilePath, {
// Expect the job does not take more than 2 minutes to complete
stale: 2 * 60 * 1000,
// use a non-exponential backoff strategy
// try once per second for 2min 10s
// Expect the jobs in the queue does not take more than 5 minutes to complete
stale: 10 * 60 * 1000,
// use a linear backoff strategy
retries: {
retries: 130,
retries: 610,
factor: 1,
minTimeout: 1000,
maxTimeout: 1000,
Expand Down

0 comments on commit 29a7622

Please sign in to comment.