-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branches 'development/2.10' and 'w/2.9/improvement/ZENKO-4941' …
…into tmp/octopus/w/2.10/improvement/ZENKO-4941
- Loading branch information
Showing
11 changed files
with
145 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
<!-- | ||
Thank you for contributing to Zenko! | ||
Please enter applicable information below. | ||
--> | ||
|
||
**What does this PR do, and why do we need it?** | ||
|
||
**Which issue does this PR fix?** | ||
|
||
fixes #<ISSUE> | ||
Fixes ZENKO-XXXX. | ||
|
||
**Special notes for your reviewers**: | ||
|
||
<!-- | ||
When adding new behavior tests, please follow the | ||
`tests/ctst/HOW_TO_WRITE_TESTS.md` guidelines. | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
VERSION="2.10.10" | ||
VERSION="2.10.11" | ||
|
||
VERSION_SUFFIX= | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# How to write a test that runs in parallel | ||
|
||
Writing integration / behavior tests that runs in parallel is not trivial. | ||
This page lists all the rules to follow when writing a test that runs in | ||
parallel with other tests. | ||
|
||
*This is specific to Zenko, but the rules are applicable for any suite of* | ||
*tests in parallel.* | ||
|
||
## 1. Tests must be idempotent. | ||
|
||
In parallel, the tests can run in any order. It's not because a test works at a | ||
given time, that it will work if the test order changes after adding new ones | ||
or renaming files. You must ensure the scenarios are fully idempotent. | ||
"Flakies" are mostly due to non-idempotent tests, then bugs. It is rarely due | ||
to the platform. | ||
|
||
## 2. Use unique resources names. S3 Bucket, Account and S3 Objects should be unique. | ||
|
||
> Use unique resources names. S3 Bucket, Account and S3 Objects should be | ||
> unique. | ||
It limits the risks of collision between tests. | ||
For cross-account scenarios, use unique S3 Policies and S3 Roles. | ||
|
||
If data is used, such as lock files, ensure they are named appropriately. | ||
|
||
## 3. Do not reconfigure the environment if it affects other tests' resources. | ||
|
||
If a reconfiguration triggers a reconciliation of the resources, running tests | ||
might be affected. Also, it restarts the services, which leads to missing logs, | ||
harder debugging, and longer test execution. | ||
|
||
For examples, location creation or bucket Website endpoints, that triggers a | ||
restart of multiple services, must be created before the test starts, or in a | ||
dedicated set of tests, that is, a set of test executed before all tests having | ||
a specific tag used for identifying the feature(s). | ||
|
||
Note: Testing the reconfiguration of the environment is recommended, but it | ||
should be done carefully to not affect other tests. | ||
|
||
## 4. Do not use `atMostOnePicklePerTag`. | ||
|
||
If a set of scenario requires the use of `atMostOnePicklePerTag`, they won't | ||
be executed in parallel, which is: | ||
|
||
- Not realistic for the production environment. | ||
- Not efficient for the test execution: the duration of tests will suffer. | ||
- A proof that the test is not following **Rule #1**. | ||
|
||
Ensuring this rule may be hard, and idempotent scenarios are not always | ||
possible. Solutions exist: | ||
|
||
- Pre-create the resources required for the tests before they start. | ||
- Use `Before` / `After` hooks to setup your environment once. | ||
Concurrency can be controlled with lock files. | ||
- Make your assertions more flexible: strict and absolute checks are good | ||
for unit or functional testing, but in integration tests, prefer using | ||
relative checks. | ||
- As a last resort, we might have a dedicated test suite. | ||
|
||
## 5. Focus on validating features. | ||
|
||
We only want to assert against externally visible state, as given in the | ||
feature requirements, and not rely on internal state or implementation | ||
details. | ||
|
||
It is tempting to write scenarios that test more than what is needed | ||
at the acceptance testing layer: use unit and functional tests to fully | ||
validate the behavior of each component; and end-to-end tests only to ensure | ||
that the product-level feature is working as expected per the requirements. | ||
Making good use of unit and functional tests makes testing all cases, including | ||
corner cases or error handling, much easier, leading to higher quality; and | ||
improves velocity by having a much faster feedback loop. | ||
|
||
## 6. Ensure assertions are idempotent after sleep times. | ||
|
||
Some tests might need to "sleep" for some time, either static or using | ||
more complex logic. The subsequent assertions must take into account | ||
any operation on the platform that might be asynchronous and take place | ||
during the sleep time. | ||
|
||
## 7. Avoid using the @Flaky tag. | ||
|
||
Whenever there is a flaky, there is an issue : either a bug (corner case or | ||
race condition) in the product, or simply an issue in the test. So the | ||
issue should be fixed either way. More often than not, retrying the build | ||
(i.e. ignoring the flaky) or automating the retry with @Flaky is just | ||
masking a bug, and leaving it in production instead of fixing it : so it | ||
must not be done. One frequent problem in flaky tests is that they are not | ||
idempotent, or that we did not do our job correctly to understand the | ||
problem. Flaky tests must be investigated, and issues in the tests must be | ||
fixed to ensure we don't ignore an actual problem in the product. | ||
|
||
## 8. Teardown resources. | ||
|
||
If a test creates resources, ensure they are deleted at the end of the test. | ||
Do not delete the resources in case of error when debugging mode is enabled, | ||
to ease debugging. | ||
|
||
Tests requiring to run at the very end of a parallel test suite with a specific | ||
naming (e.g., `zzz.*`) should be removed. Prefer using `After` hooks with | ||
specific tags. | ||
|
||
## 9. Validate your test before merging. | ||
|
||
If a test passes once, ensure it passes for the good reasons. | ||
False positives are hard to detect once merged. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4527,9 +4527,9 @@ cli-table3@^0.6.0: | |
optionalDependencies: | ||
"@colors/colors" "1.5.0" | ||
|
||
"cli-testing@github:scality/cli-testing.git#1.2.3": | ||
version "1.2.3" | ||
resolved "git+ssh://[email protected]/scality/cli-testing.git#d6712d412dd7cd56cdf89a812203637d1ebab210" | ||
"cli-testing@github:scality/cli-testing.git#1.2.4": | ||
version "1.2.4" | ||
resolved "git+ssh://[email protected]/scality/cli-testing.git#687c3bdb5d684c5de4082a5dd9f9c00e94ec104c" | ||
dependencies: | ||
"@aws-crypto/sha256-universal" "^5.2.0" | ||
"@aws-sdk/client-iam" "^3.637.0" | ||
|