From ba53a9532a11d74df851c0f42f396e412d350a7d Mon Sep 17 00:00:00 2001 From: Oleg Jukovec Date: Mon, 9 Jan 2023 18:29:48 +0300 Subject: [PATCH] ci: add tests with data race detector Tests execution result may differ due to different timings, so it is better to test together, rather than instead. Closes #218 --- .github/workflows/testing.yml | 20 ++++++++++++++++---- CHANGELOG.md | 3 +++ CONTRIBUTING.md | 7 +++++++ Makefile | 6 ++++++ 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index c4516e5bd..05fee7835 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -97,16 +97,24 @@ jobs: run: make deps - name: Run regression tests - run: make test + run: | + make test + make testrace - name: Run regression tests with call_17 - run: make test TAGS="go_tarantool_call_17" + run: | + make test TAGS="go_tarantool_call_17" + make testrace TAGS="go_tarantool_call_17" - name: Run regression tests with msgpack.v5 - run: make test TAGS="go_tarantool_msgpack_v5" + run: | + make test TAGS="go_tarantool_msgpack_v5" + make testrace TAGS="go_tarantool_msgpack_v5" - name: Run regression tests with msgpack.v5 and call_17 - run: make test TAGS="go_tarantool_msgpack_v5,go_tarantool_call_17" + run: | + make test TAGS="go_tarantool_msgpack_v5,go_tarantool_call_17" + make testrace TAGS="go_tarantool_msgpack_v5,go_tarantool_call_17" - name: Run fuzzing tests if: ${{ matrix.fuzzing }} @@ -189,6 +197,7 @@ jobs: run: | source tarantool-enterprise/env.sh make test + make testrace env: TEST_TNT_SSL: ${{matrix.ssl}} @@ -196,6 +205,7 @@ jobs: run: | source tarantool-enterprise/env.sh make test TAGS="go_tarantool_call_17" + make testrace TAGS="go_tarantool_call_17" env: TEST_TNT_SSL: ${{matrix.ssl}} @@ -203,6 +213,7 @@ jobs: run: | source tarantool-enterprise/env.sh make test TAGS="go_tarantool_msgpack_v5" + make testrace TAGS="go_tarantool_msgpack_v5" env: TEST_TNT_SSL: ${{matrix.ssl}} @@ -210,6 +221,7 @@ jobs: run: | source tarantool-enterprise/env.sh make test TAGS="go_tarantool_msgpack_v5,go_tarantool_call_17" + make testrace TAGS="go_tarantool_msgpack_v5,go_tarantool_call_17" env: TEST_TNT_SSL: ${{matrix.ssl}} diff --git a/CHANGELOG.md b/CHANGELOG.md index acfe2a914..48b38049e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,11 +11,14 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release. ### Added - Support pagination (#246) +- A Makefile target to test with race detector (#218) ### Changed ### Fixed +- Several non-critical data race issues (#218) + ## [1.10.0] - 2022-12-31 The release improves compatibility with new Tarantool versions. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 15bccd3a6..ba0f0c7ab 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,12 +26,18 @@ To run tests for the main package and each subpackage: make test ``` +To run tests for the main package and each subpackage with race detector: +```bash +make testrace +``` + The tests set up all required `tarantool` processes before run and clean up afterwards. If you want to run the tests with specific build tags: ```bash make test TAGS=go_tarantool_ssl_disable,go_tarantool_msgpack_v5 +make testrace TAGS=go_tarantool_ssl_disable,go_tarantool_msgpack_v5 ``` If you have Tarantool Enterprise Edition 2.10 or newer, you can run additional @@ -39,6 +45,7 @@ SSL tests. To do this, you need to set an environment variable 'TEST_TNT_SSL': ```bash TEST_TNT_SSL=true make test +TEST_TNT_SSL=true make testrace ``` If you want to run the tests for a specific package: diff --git a/Makefile b/Makefile index be1f6757f..60016ee3c 100644 --- a/Makefile +++ b/Makefile @@ -50,6 +50,12 @@ test: testdata: (cd ./testdata; ./generate.sh) +.PHONY: testrace +testrace: + @echo "Running all packages tests with data race detector" + go clean -testcache + go test -race -tags "$(TAGS)" ./... -v -p 1 + .PHONY: test-connection-pool test-connection-pool: @echo "Running tests in connection_pool package"