ARO-RP/docs/testing.md

73 строки
1.4 KiB
Markdown
Исходник Обычный вид История

2020-01-24 02:55:22 +03:00
# Testing
2020-02-27 16:34:46 +03:00
## Unit tests
2020-01-24 02:55:22 +03:00
2020-05-01 16:58:19 +03:00
To run RP unit tests:
```bash
make test-go
```
2020-05-01 16:58:19 +03:00
To run python client and `az aro` CLI tests:
```bash
make test-python
```
2020-01-24 02:55:22 +03:00
To run Go linting tasks (requires [golanglint-ci](https://golangci-lint.run/usage/install/) to be installed):
```bash
make lint-go
```
For faster feedback, you may want to set up [golanglint-ci's editor integration](https://golangci-lint.run/usage/integrations/).
2020-02-27 16:34:46 +03:00
## E2e tests
2020-01-24 02:55:22 +03:00
2020-02-27 16:35:25 +03:00
E2e tests can be run in CI with the `/azp run e2e` command in your GitHub PR.
2020-01-24 17:06:05 +03:00
2020-02-27 16:35:25 +03:00
E2e tests can also be run locally as follows:
- Deploy or use an existing cosmos database
2020-02-27 16:34:46 +03:00
- Run the RP
2020-02-27 16:35:25 +03:00
- Validate the RP is running properly by hitting the `/healthz` route
- Register a subscription where to run the e2e
- Run the `make test-e2e` target
2020-10-22 17:10:09 +03:00
- Delete the cosmos database, if applicable
2020-01-24 17:06:05 +03:00
2020-02-27 16:35:25 +03:00
These steps can be acheived using commands below. Look at the [e2e helper
file](../hack/e2e/run-rp-and-e2e.sh) to understand each of the bash functions
below.
2020-01-24 17:06:05 +03:00
2020-02-27 16:34:46 +03:00
```bash
# source your environment file
. ./secrets/env
2020-02-27 16:35:25 +03:00
# source the e2e helper file
. ./hack/e2e/run-rp-and-e2e.sh
2020-02-27 16:34:46 +03:00
# Deploy a new DB
deploy_e2e_db
# build the rp binary
make aro
# run the RP as background process
run_rp
# validate if the RP is ready to receive requests
validate_rp_running
2020-02-27 16:35:25 +03:00
# Register the sub you are using to run e2e
2020-02-27 16:34:46 +03:00
register_sub
2020-02-27 16:35:25 +03:00
# Run e2e
2020-11-02 20:49:11 +03:00
make test-e2e
2020-02-27 16:34:46 +03:00
# Stop the local RP
kill_rp
# Delete the DB
clean_e2e_db
```