Retriggering Integration Tests

Integration test(s) for a given snapshot can be re-triggered by adding the test.appstudio.openshift.io/run label to the snapshot.

Supported Values for the label

  • all: Reruns all the IntegrationTestScenarios (both optional and required) whose contexts match the snapshot. Example command:

$ kubectl label snapshot [snapshot name] test.appstudio.openshift.io/run=all
  • [scenario name]: Reruns a specific IntegrationTestScenario, regardless of whether its context matches the snapshot. Replace [scenario name] with the name of the IntegrationTestScenario you want to retrigger. Example command:

$ kubectl label snapshot [snapshot name] test.appstudio.openshift.io/run=[scenario name]

Prerequisites

  • You have a snapshot that has completed all its initial tests. All initial tests must be finished before you trigger subsequent tests.

  • The snapshot for which tests will be retriggered has completed its initial tests.

  • You have CLI access to the specific OpenShift cluster. For information on obtaining CLI access, refer Getting started with the CLI.

Procedure

Identify the snapshot to retrigger tests for. You can find the related snapshot on the pipelineRun details page in the UI. Example:

IntegrationTestScenario Snapshot

Retrigger via UI:

  1. Click on the three vertical dots on the right side of the pipelineRun details page seen above.

  2. From the expanded menu, select "Rerun".

Retrigger via CLI:

  1. Add the test.appstudio.openshift.io/run label to the snapshot, with any of the supported values as shown above.

  2. The tests are re-triggered automatically. Once they are re-triggered, the system removes the label, allowing you to apply a new label for a different scenario if you wish to test multiple scenarios. Verify that the test(s) have started.

    $ tkn pipelinerun list
    
    [Example Output]
    NAME                            STARTED         DURATION   STATUS
    integration-pipelinerun-jfrdb   4 seconds ago   ---        Running
    If you run the command long after retriggering, the pipelineRun might have been pruned. The output may also include other unrelated pipelineRuns.

Verification

  1. To verify the tests, run tkn pipelinerun describe [pipelinerun] and ensure that the labels appstudio.openshift.io/snapshot and test.appstudio.openshift.io/scenario reference the correct snapshot and scenario.

    $ tkn pipelinerun describe integration-pipelinerun-jfrdb
    
    [Expected labels in the output]
    Name:              integration-pipelinerun-jfrdb
    Namespace:         default
    Service Account:   appstudio-pipeline
    Labels:
    ...
     appstudio.openshift.io/snapshot=snapshot-sample
    ...
     test.appstudio.openshift.io/test=component
    ...