Retriggering Integration Tests

Integration test scenarios for a given snapshot can be re-triggered by adding a label to the snapshot.

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
  1. Identify the IntegrationTestScenario that needs to be rerun. For a given snapshot, you can only rerun one IntegrationTestScenario. The related snapshot can be found on the pipelineRun details page in the UI, as shown in the example below:

    IntegrationTestScenario Snapshot
  2. To rerun within the UI, click on the three vertical dots on the right side of the details page mentioned above. From the expanded menu, select "Rerun". Alternatively, follow the below steps to rerun via the CLI.

  3. Label the snapshot with test.appstudio.openshift.io/run, assigning the scenario name you wish to rerun as its value.

    $ kubectl label snapshot [snapshot name] test.appstudio.openshift.io/run=[scenario name]
  4. 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.

    $ tkn pipelinerun list
    
    [Example Output]
    NAME                            STARTED         DURATION   STATUS
    integration-pipelinerun-jfrdb   4 seconds ago   ---        Running
    This command is used to verify that a re-triggered integration pipelineRun has started. If you run this command long after the re-trigger command, it may not show any output because pipelineRun resources are pruned after completion. Additionally, the command may display other unrelated pipelineRuns that are in progress at the same time.
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
    ...