-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: skip-if conditional scenario skip
Adds support for `skip-if` collection of evaluable conditions for a scenario. If any of these conditions fails, the test will be skipped. SkipIf contains a list of evaluable conditions that must evaluate successfully before the scenario's tests are executed. This allows test authors to specify "pre-flight checks" that should pass before attempting any of the actions in the scenario's tests. For example, let's assume you have a `gdt-kube` scenario that looks like this: ```yaml tests: - kube.create: manifests/nginx-deployment.yaml - kube: get: deployments/nginx assert: matches: status: readyReplicas: 2 - kube.delete: deployments/nginx ``` If you execute the above test and there is already an 'nginx' deployment, the `kube.create` test will fail. To prevent the scenario from proceeding with the tests if an 'nginx' deployment already exists, you could add the following ```yaml skip-if: - kube.get: deployments/nginx tests: - kube.create: manifests/nginx-deployment.yaml - kube: get: deployments/nginx assert: matches: status: readyReplicas: 2 - kube.delete: deployments/nginx ``` With the above, if an 'nginx' deployment exists already, the scenario will skip all the tests. Signed-off-by: Jay Pipes <jaypipes@gmail.com>
- Loading branch information
Showing
7 changed files
with
143 additions
and
23 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
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: skip-if | ||
description: a scenario with a skip-if condition | ||
skip-if: | ||
- foo: bar | ||
# This causes the evaluation to fail (expects name=bar when foo=bar) | ||
name: buzzy | ||
tests: | ||
- foo: bar | ||
# Normally this would cause the test to fail, but this will be skipped due | ||
# to the skip-if above. | ||
name: bizzy |