What Are Test Tags?
Functional tests use Avocado, which uses tags to label tests. A test can have many tags, and a tag can belong to many tests. These tags are specified in a docstring comment for each test function. For example:
def test_evict(self): """ :avocado: tags=all,pr,daily_regression :avocado: tags=vm :avocado: tags=pool,pool_evict :avocado: tags=pool_evict_basic """
How Does Avocado Handle Sets of Tags?
Avocado uses commas and spaces to specify sets of tests. For example:
pr,ior
- All tests tagged with bothpr
andior
pr ior
- All tests tagged withpr
, plus all tests tagged withior
pr,ior pr,mdtest
- All tests tagged with bothpr
andior
, plus all tests tagged with bothpr
andmdtest
Avocado uses a hyphen to mean “not”. For example:
pr,-ior
- All tests tagged withpr
but notior
pr,-ior,-mdtest
- All tests tagged withpr
but notior
ormdtest
More information about Avocado tag filtering can be found here.
How Do I Use Test Tags in a PR?
The /wiki/spaces/CI/pages/1389759093 specify which tests are run for a PR. By default, all tests tagged with pr
are ran. I.e. Test-tag: pr
. To run specific tests, you should first identify which tags you need. See Feature Tags for a list of common tags. To run a specific test case, you will need to find its tag in the test file. There are two pragmas to specify which tags to run:
Test-tag
- Runs only the tags specified.Test-tag: pr checksum
- Runspr
tests andchecksum
tests.Test-tag: checksum
- Runs onlychecksum
tests.
Features
- Runs the default set of tags (pr
), plus the tags specified minusfull_regression
.Features: checksum
- Equivalent toTest-tag: pr checksum,-full_regression
Whether to use Test-tag
or Features
mostly depends on whether you want to include the full_regression
tests for the specified feature tag. In the future, full_regression
tests will not be excluded, and Features
will be recommended for most cases.
pr
tests are almost always required to pass for a PR to be merged.
When Do I Need to Specify Test Tags?
When a change is 100% covered by existing unit tests, there is no need to specify additional tags.
When a change is covered by new unit tests, you might need to specify the corresponding Feature Tag.
When a change is not 100% covered by unit tests, you do need to specify the corresponding Feature Tag.
E.g. Middleware applications, high-level functional verification, 3rd-party libraries, integration
When a change modifies or adds Functional Tests or the Functional Test Framework, you do need to specify the corresponding Feature Tags and/or Specific Test Tags.
When a change fixes a failing Functional Test, you do need to specify the corresponding Specific Test Tags.
List of Frequency Tags
These tags determine when a test runs. Some tests might be ran at multiple frequencies.
Avocado Tag | Description |
---|---|
| Ran in CI for every PR. These are generally small core tests. |
| Ran in CI once daily. These are generally less critical than |
| Ran in CI weekly. These are generally less critical than |
| Manual tests for special purposes. These tests might: not run in CI, require special configuration, be for specific environments. |
| SOAK tests are ran manually at specified intervals. |
| Ran when deploying a new DAOS installation. |
List of Stage/Environment Tags
These tags determine where a test runs. Each test should only have one set of these tags.
Avocado Tag | Description |
---|---|
| Tests that are ran on the Functional Hardware Small stage |
| Tests that are ran on the Functional Hardware Medium stage. |
| Tests that are ran on the Functional Hardware Large stage. |
| Tests that are ran on the VM Functional on [CentOS, Leap, Ubuntu] stages. This tag is usually not specified explicitly. Instead, the lack of a |
List of Feature Tags
These tags group tests by common Features. This list is currently incomplete.
Avocado Tag | Description |
---|---|
| Verifies |
| Verifies |
| Verifies |
| Verifies Data Mover utilities. Additional sub-tags:
|
| Verifies |
| Verifies DAOS on a newly deployed system. |
| Verifies |
| Verifies |
| Verifies |
| Verifies |
| Verifies online and offline |
| Verifies features related to |
| Verifies |
| Verifies |
| Verifies |
| Verifies |
Finding Specific Test Tags
Each test has a unique tag that can be used to run only that test. When there is need to run a specific test, the tag must be looked up in the corresponding ftest/<dir>/<test_file>.py
. Unique test tags are usually on the last line of Avocado tags. For example, from ftest/pool/evict.py, the pool_evict_basic
tag will run only this test:
def test_evict(self): """ :avocado: tags=all,pr,daily_regression :avocado: tags=vm :avocado: tags=pool,pool_evict :avocado: tags=pool_evict_basic """