diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b25c9e389..8e1cb9bc3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -96,7 +96,7 @@ jobs: - name: test run: | - go test -v '-covermode=count' '-coverprofile=coverage.out' + go test -v '-race' '-covermode=atomic' '-coverprofile=coverage.out' - name: Send coverage uses: shogo82148/actions-goveralls@v1 diff --git a/driver_test.go b/driver_test.go index dd3d73141..74f15c2d2 100644 --- a/driver_test.go +++ b/driver_test.go @@ -1872,7 +1872,6 @@ func TestConcurrent(t *testing.T) { defer wg.Done() tx, err := dbt.db.Begin() - atomic.AddInt32(&remaining, -1) if err != nil { if err.Error() != "Error 1040: Too many connections" { @@ -1882,7 +1881,7 @@ func TestConcurrent(t *testing.T) { } // keep the connection busy until all connections are open - for remaining > 0 { + for atomic.AddInt32(&remaining, -1) > 0 { if _, err = tx.Exec("DO 1"); err != nil { fatalf("error on conn %d: %s", id, err.Error()) return