feat: add skip field to test steps #2307
Draft
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.
Implements #2297 - Add ability to skip steps based on conditions
This PR adds a new 'skip' field to TestStepSpec that allows steps to be conditionally skipped based on a boolean value or a template expression.
Added Skip field to TestStepSpec
Added unit tests for the Skip field
Added documentation for the skip feature
Explanation
This PR adds a new skip field to test steps, allowing steps to be conditionally skipped based on a boolean value or a template expression. Users can now define conditional test flows where specific steps are run or skipped based on environment variables or other conditions. This enhances test flexibility and enables creating more adaptable test suites that can run in different environments without requiring script-based workarounds.
Related issue
Fixes #2297
Proposed Changes
This PR implements the ability to skip steps in a test based on conditions as requested in issue #2297.
The implementation includes:
**API Changes: **
Tests:
Documentation:
Usage notes and caveats
Updated the mkdocs navigation to include the new documentation
Note: The runner implementation is not complete due to import issues in the runner.go file. Help from maintainers would be appreciated to complete this part.
Checklist
Further Comments
This PR provides the foundation for the skip feature by implementing the API changes, tests, and documentation. The runner implementation has issues with conflicting imports in the runner.go file, which would benefit from assistance from maintainers who are more familiar with the codebase.
Currently, the API part and documentation are fully functional and tested. The implementation follows the same pattern as other conditional features in the codebase, supporting both static values and templated expressions.