Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: skip-if conditional scenario skip #5

Merged
merged 1 commit into from
Jul 28, 2023
Merged

feature: skip-if conditional scenario skip #5

merged 1 commit into from
Jul 28, 2023

Commits on Jul 28, 2023

  1. feature: skip-if conditional scenario skip

    Adds support for `skip-if` collection of evaluable conditions for a
    scenario. If any of these conditions succeed, the test will be skipped.
    This allows test authors to specify "pre-flight checks" 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>
    jaypipes committed Jul 28, 2023
    Configuration menu
    Copy the full SHA
    2f248d2 View commit details
    Browse the repository at this point in the history