From 840e9a02e23220934ca8b7deeb696ba1fd656cae Mon Sep 17 00:00:00 2001 From: Tiexin Guo Date: Tue, 28 Jun 2022 10:14:50 +0800 Subject: [PATCH] docs: e2e test doc update Signed-off-by: Tiexin Guo --- docs/development/test.md | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/docs/development/test.md b/docs/development/test.md index 8ed3506bf..81cfde5b3 100644 --- a/docs/development/test.md +++ b/docs/development/test.md @@ -1,30 +1,48 @@ # Test -### Unit Test +## Unit Test Run all unit tests: ```shell +# at the root of the repo go test ./... ``` -### End-to-end Tests +_Note: not all tests are strictly "unit" tests at the moment because some tests will actually rely on internet. Help wanted here :)_ -#### 1. e2e Test with Github Action +## E2E(End-to-End) Test -GitHub Actions will run e2e test automatically. +### GitHub Actions -#### 2. e2e Test Locally +Our e2e test will run in GitHub Actions automatically when there is a change on the main branch. -```shell -bash hack/e2e/e2e-run.sh -``` +The definition of the GitHub Action is [here](https://github.com/devstream-io/devstream/blob/main/.github/workflows/e2e-test.yml), and the configuration files used in e2e tests are [here](https://github.com/devstream-io/devstream/tree/main/test/e2e/yaml). + +### Run E2E Test Locally + +We have a simple e2e test that tests the following plugins: + +- `github-repo-scaffolding-golang` +- `githubactions-golang` +- `argocd` +- `argocdapp` + +The template for the config file is located [here](https://github.com/devstream-io/devstream/blob/main/test/e2e/yaml/e2e-test-local.yaml). -This test script depends on the following environment variables: +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 - DOCKERHUB_TOKEN -Set it before test. +And execute the following command: + +```shell +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.