Commit 6f4625bb by Barry Committed by Sofia Papagiannaki

Update docs readme for running MySQL/Postgres tests

parent 3680b95b
...@@ -147,12 +147,34 @@ Writing & watching frontend tests ...@@ -147,12 +147,34 @@ Writing & watching frontend tests
```bash ```bash
# Run Golang tests using sqlite3 as database (default) # Run Golang tests using sqlite3 as database (default)
go test ./pkg/... go test ./pkg/...
```
##### Running the MySQL or Postgres backend tests:
Run these by setting `GRAFANA_TEST_DB` in your environment.
- `GRAFANA_TEST_DB=mysql` to test MySQL
- `GRAFANA_TEST_DB=postgres` to test Postgres
Follow the instructions in `./devenv` to spin up test containers running the appropriate databases with `docker-compose`
- Use `docker/blocks/mysql_tests` or `docker/blocks/postgres_tests` as appropriate
# Run Golang tests using mysql as database - convenient to use /docker/blocks/mysql_tests ```bash
GRAFANA_TEST_DB=mysql go test ./pkg/... # MySQL
# Tests can only be ran in one Go package at a time due to clashing db queries. To run MySQL tests for the "pkg/services/sqlstore" package, run:
GRAFANA_TEST_DB=mysql go test ./pkg/services/sqlstore/...
# Or run all the packages using the circle CI scripts. This method will be slower as the scripts will run all the tests, including the integration tests.
./scripts/circle-test-mysql.sh
```
```bash
# Postgres
# Tests can only be ran in one Go package at a time due to clashing db queries. To run Postgres tests for the "pkg/services/sqlstore" package, run:
GRAFANA_TEST_DB=postgres go test ./pkg/services/sqlstore/...
# Run Golang tests using postgres as database - convenient to use /docker/blocks/postgres_tests # Or run all the packages using the circle CI scripts. This method will be slower as the scripts will run all the tests, including the integration tests.
GRAFANA_TEST_DB=postgres go test ./pkg/... ./scripts/circle-test-postgres.sh
``` ```
#### End-to-end #### End-to-end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment