Skip to content

Test

Unit Test

Run all unit tests:

Bash
# at the root of the repo
go test ./...

Note: not all tests are strictly "unit" tests at the moment because some tests will actually rely on internet. Help wanted here :)

E2E(End-to-End) Test

GitHub Actions

Our e2e test will run in GitHub Actions automatically when there is a change on the main branch.

The definition of the GitHub Action is here, and the configuration files used in e2e tests are here.

Run E2E Test Locally

We have a simple e2e test that tests the following plugins:

  • repo-scaffolding
  • github-actions
  • argocd
  • argocdapp

The template for the config file is located here.

To run the e2e test locally, you will need docker up and running first.

Then, set the following environment variables:

  • GITHUB_USER
  • GITHUB_TOKEN
  • DOCKERHUB_USERNAME
  • IMAGE_REPO_PASSWORD

And execute the following command:

Bash
bash hack/e2e/e2e-run.sh

This test script will download kind/kubectl, start a K8s cluster as a docker container using kind, then execute dtm commands, check result, and clean up the environment.