From b9b23c66d8a4bb17c4729db8b96bb5bd9855c4a4 Mon Sep 17 00:00:00 2001 From: Matija Salopek Date: Thu, 8 Sep 2022 14:21:49 +0200 Subject: [PATCH] allow selecting test granularity using make Adds new commands to makefile: * make test-short (unit, e2e) * make test-diff (difference tests only) * make test-integration (integration tests only) * make test-no-cache (equivalent to make test with caching disabled) Closes: #345 --- Makefile | 17 +++++++++++++++++ README.md | 21 ++++++++++++++++++--- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b64c07de77..65356875f4 100644 --- a/Makefile +++ b/Makefile @@ -7,9 +7,26 @@ install: go.sum go install $(BUILD_FLAGS) ./cmd/interchain-security-pd go install $(BUILD_FLAGS) ./cmd/interchain-security-cd +# run all tests: unit, e2e and diff test: go test ./... +# run e2e and unit tests +test-short: + go test ./tests/e2e/... ./x/... ./app/... + +# run difference tests +test-diff: + go test ./tests/difference/... + +# run integration tests +test-integration: + go run ./tests/integration/... + +# run all tests with caching disabled +test-no-cache: + go test ./... -count=1 + BUILD_TARGETS := build build: BUILD_ARGS=-o $(BUILDDIR)/ diff --git a/README.md b/README.md index bba83d9f4e..da817b764b 100644 --- a/README.md +++ b/README.md @@ -64,12 +64,27 @@ Similar to e2e tests, but they compare the system state to an expected state gen [Integration tests](./tests/integration/) run true consumer and provider chain binaries within a docker container and are relevant to the highest level of functionality. Integration tests use queries/transactions invoked from CLI to drive and validate the code. ### Running Tests +Tests can be run using `make`: ```bash -# run all static analysis, unit, e2e, and integration tests using make -TODO -# run all unit and e2e tests using make +# run all static analysis, unit, e2e, and integration tests make test + +# run unit and e2e tests - prefer this for local development +make test-short + +# run difference tests +make test-diff + +# run integration tests +make test-integration + +# equivalent to make test with caching disabled +make test-no-cache +``` + +Alternatively you can run tests using `go test`: +```bash # run all unit and e2e tests using go go test ./... # run all unit and e2e tests with verbose output