This component executes test in component catalogs. It executes child pipelines as unit or end to end tests isolated from your main pipeline. In addition it will lint the test pipeline against the GitLab pipeline linter.
Variables
| Name | required | Hints |
|---|---|---|
| CI_UNIT_TEST_TEMPLATE | --- | Is injected with the value of the current tested template e.g. templates/my-component/test.yaml into the environment |
Usage
- Create a new component
my-componentin your new component catalog projectmy-catalogthat needs testing - Create a new pipeline file
templates/my-component/test.yamlincluding a usage example
include:
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/common@stable
- component: $CI_SERVER_FQDN/components/my-catalog/my-component@$CI_COMMIT_SHA
inputs:
parameter-01: true
parameter-02: "string"
- Add a test component to your main pipeline file
templates/my-component/test.ymlincluding a usage example
include:
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/common@$CI_COMMIT_SHA
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/test-component@$CI_COMMIT_SHA
inputs:
stage: test
name: test-my-catalog
template: 'templates/my-component/test.yml'
Inputs
| Name | Description | Default | Type |
| --- | --- | --- | --- |
| allow-failure | If true, the job will not fail the pipeline if it fails | false | boolean |
| name | The name of the job | string | |
| needs | The jobs that this job depends on. | [] | array |
| project | The project to test | $CI_PROJECT_PATH | string |
| rules | The jobs that this job depends on. | [{"if":"$CI_PIPELINE_SOURCE == \"schedule\"","when":"never"},{"if":"$CI_COMMIT_TAG","when":"never"},{"if":"$CI_PIPELINE_SOURCE == \"merge_request_event\"","when":"on_success"},{"when":"on_success"}] | array |
| stage | The name of the stage | test | string |
| strategy | The trigger strategy | mirror | string |
| template | The name of the template for the test | string | |
| version | The version of the component to test. Usually a branch name or tag. Defaults to the commit hash. | $CI_COMMIT_SHA | string |