From a9788e0687fb1879d8a812d56a83be3c09b4bf5c Mon Sep 17 00:00:00 2001 From: Benehiko Date: Thu, 4 Mar 2021 20:24:53 +0200 Subject: [PATCH 1/2] docs: improve readme tests section --- README.md | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 391d6232a7c..f6d4b0aebb8 100644 --- a/README.md +++ b/README.md @@ -435,18 +435,47 @@ There are three types of tests you can run: - Regular tests (do require PostgreSQL, MySQL, CockroachDB) - End to end tests (do require databases and will use a test browser) +All of the above tests can be run using the makefile. See the commands below. + +**Makefile commands** + + # quick tests + make quicktest + + # regular tests + make test + test-resetdb + + # end-to-end tests + make e2e + + ##### Short Tests +It is recommended to use the make file to run your tests using `make quicktest` +, however, you can still use the `go test` command. + +**Please note**: + +Running quick tests will use the sqlite database +thus add `-tags sqlite` when building the binary. + Short tests run fairly quickly. You can either test all of the code at once: ```shell script -go test -short ./... +go test -v -failfast -short -tags sqlite ./... ``` or test just a specific module: ```shell script -cd client; go test -short . +cd client; go test -v -failfast -short -tags sqlite . +``` + +or a specific test: + +```shell script +go test -v -failfast -short -tags sqlite -run ^TestName$ ./... ``` ##### Regular Tests From da5b70760cbdb1a5ad821cd65c0e0a5e5ff0fc63 Mon Sep 17 00:00:00 2001 From: Benehiko Date: Mon, 8 Mar 2021 10:05:16 +0200 Subject: [PATCH 2/2] docs: update readme test section --- README.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index f6d4b0aebb8..b6db17b5fcd 100644 --- a/README.md +++ b/README.md @@ -439,16 +439,17 @@ All of the above tests can be run using the makefile. See the commands below. **Makefile commands** - # quick tests - make quicktest +```shell +# quick tests +make quicktest - # regular tests - make test - test-resetdb - - # end-to-end tests - make e2e +# regular tests +make test +test-resetdb +# end-to-end tests +make e2e +``` ##### Short Tests @@ -457,8 +458,8 @@ It is recommended to use the make file to run your tests using `make quicktest` **Please note**: -Running quick tests will use the sqlite database -thus add `-tags sqlite` when building the binary. +All tests run against a sqlite in-memory database, +thus it is required to use the `-tags sqlite` build tag. Short tests run fairly quickly. You can either test all of the code at once: @@ -469,7 +470,7 @@ go test -v -failfast -short -tags sqlite ./... or test just a specific module: ```shell script -cd client; go test -v -failfast -short -tags sqlite . +go test -v -failfast -short -tags sqlite ./client ``` or a specific test: