Choosing when to run certain Integration Tests
Integration test scenarios can be configured to run in only certain cases (referred to as contexts in further text). Examples include running the integration test pipelines only in case of Pull Requests, or running them only for builds of specific components. The full list of supported contexts is:
-
“application” - runs the integration test in all cases - this is the default state
-
“component” - runs the integration tests only in case of component builds
-
This context is run for builds of all components, but not for special cases like manually created Snapshots
-
-
“component_COMPONENT” - runs the integration test only for a build of a specific component
-
For a component
sample-component
, this context would need to becomponent_sample-component
-
-
"pull_request” - runs the integration test in case of the Snapshot being created for a
pull request
event -
“push” - runs the integration test in case of the Snapshot being created for a
push
event -
"override” - runs the integration test for an
override
Snapshot-
See more in Creating an override snapshot
Setting more than one context in the list will run the IntegrationTestScenario for all included contexts. -
-
You have CLI access to the specific OpenShift cluster. For information on obtaining CLI access, refer Getting started with the CLI.
-
Choose the IntegrationTestScenario that you want to run only in certain cases.
-
Edit the chosen IntegrationTestScenario using kubectl.
$ kubectl edit integrationtestscenario [integrationtestscenario name]
-
Modify the
contexts
field by setting the list of contexts you wish the IntegrationTestScenario.Example integrationTestScenario configuration with the pull_request context:
apiVersion: appstudio.redhat.com/v1beta1 kind: IntegrationTestScenario metadata: name: example-pass namespace: default spec: application: application-sample contexts: - description: PR testing name: pull_request resolverRef: resolver: git params: - name: url value: https://github.com/konflux-ci/integration-examples - name: revision value: main - name: pathInRepo value: pipelines/integration_pipeline_pass.yaml
-
To verify the configuration, run a component build in the desired context (e.g. as part of a Pull Request) and verify if the integration test pipeline was executed according to your expectations.