Kaynağa Gözat

Update docs readme for running MySQL/Postgres tests

Barry 6 yıl önce
ebeveyn
işleme
6f4625bb78
1 değiştirilmiş dosya ile 26 ekleme ve 4 silme
  1. 26 4
      README.md

+ 26 - 4
README.md

@@ -147,12 +147,34 @@ Writing & watching frontend tests
 ```bash
 # Run Golang tests using sqlite3 as database (default)
 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
-GRAFANA_TEST_DB=mysql go test ./pkg/...
+```bash
+# 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
-GRAFANA_TEST_DB=postgres go test ./pkg/...
+# 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-postgres.sh
 ```
 
 #### End-to-end