[8.16](backport #5900) Introduce filter by group and dry-run for integration tests #6398
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR adds a
TestMain()
to thetesting/integration
package to allow passing some command-line arguments when running integration tests usinggo test
:-integration.groups
allows to specify a comma-separated list of groups to filter on-integration.dry-run
will validate define constraints but will skip the real tests that containdefine
directives and add a placeholder<Test name>/dry-run
which will pass if all thedefine
checks passThe
groups
flag allows for a simple way of selecting a subset of tests (for either real running or dry-runs)The
sudo
flag allows to filter tests based on their sudo requirements (if those need to run as root/administrator or not)The
dry-run
argument allows for quick execution when experimenting with group filtering (making sure that what would be executed matches expectations)Why is it important?
Running by groups should simplify initial implementation of running Integration tests on CI
Checklist
./changelog/fragments
using the changelog toolDisruptive User Impact
How to test this PR locally
(since it's a dry-run it won't actually run the tests)
Adding a sudo filter for running only test that do not require sudo:
Related issues
Questions to ask yourself
This is an automatic backport of pull request #5900 done by [Mergify](https://mergify.com).