Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: e2e test doc update #770

Merged
merged 1 commit into from
Jun 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 28 additions & 10 deletions docs/development/test.md
Original file line number Diff line number Diff line change
@@ -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.