이 페이지는 아직 한국어로 제공되지 않으며 번역 작업 중입니다. 번역에 관한 질문이나 의견이 있으시면 언제든지 저희에게 연락해 주십시오.

Overview

Run Continuous Testing tests in your GitLab pipelines, block deployments, and trigger rollbacks to ensure your code is added in production when your essential business workflows are functioning as expected.

To integrate Continuous Testing tests with a GitLab pipeline, you can use the datadog-ci npm package.

Setup

To get started:

  1. Add your Datadog API and application keys as variables in your GitLab project.
  2. Ensure your GitLab runner has a version of Node.js >= 10.24.1 installed.

For more information, see CI/CD Integrations Configuration.

Simple configuration

Run tests using test IDs

stages: 
  - test
synthetic-tests:
  stage: test
  script: 
    - npm install -g @datadog/datadog-ci
    - datadog-ci synthetics run-tests --apiKey "$DATADOG_API_KEY" --appKey "$DATADOG_APP_KEY" --public-id xtf-w5p-z5n --public-id eif-van-tu7

Run tests using tags

stages: 
  - test
synthetic-tests:
  stage: test
  script: 
    - npm install -g @datadog/datadog-ci
    - datadog-ci synthetics run-tests --apiKey "$DATADOG_API_KEY" --appKey "$DATADOG_APP_KEY" -s 'tag:e2e-tests'

Run tests using variable overrides

If you have different test users or data specific to your CI/CD environment, you can override these variables with the -v command. For more information, see the Synthetics command in the datadog-ci NPM package.

stages: 
  - test
synthetic-tests:
  stage: test
  script: 
    - npm install -g @datadog/datadog-ci
    - datadog-ci synthetics run-tests --apiKey "$DATADOG_API_KEY" --appKey "$DATADOG_APP_KEY" -s 'tag:e2e-tests' -v PASSWORD="$PASSWORD"

Advanced configuration

Run tests using a custom configuration file

Add a custom config.json file to your pipeline repository and access it in your pipeline configuration.

stages: 
  - test
synthetic-tests:
  stage: test
  script: 
    - npm install -g @datadog/datadog-ci
    - datadog-ci synthetics run-tests --apiKey "$DATADOG_API_KEY" --appKey "$DATADOG_APP_KEY" --config synthetics_global.json -f synthetic_test.json

Test output

This example demonstrates the pipeline has identified the configuration file and is running the test:

A Synthetic test running in GitLab

A successful test output returns the following in GitLab:

A successful Synthetic test run result in a GitLab pipeline

Further reading