Skip to content

Commit 685bded

Browse files
committed
fix race condition of TestConcurrent
1 parent 3798012 commit 685bded

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

driver_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,7 +1872,6 @@ func TestConcurrent(t *testing.T) {
18721872
defer wg.Done()
18731873

18741874
tx, err := dbt.db.Begin()
1875-
atomic.AddInt32(&remaining, -1)
18761875

18771876
if err != nil {
18781877
if err.Error() != "Error 1040: Too many connections" {
@@ -1882,7 +1881,7 @@ func TestConcurrent(t *testing.T) {
18821881
}
18831882

18841883
// keep the connection busy until all connections are open
1885-
for remaining > 0 {
1884+
for atomic.AddInt32(&remaining, -1) > 0 {
18861885
if _, err = tx.Exec("DO 1"); err != nil {
18871886
fatalf("error on conn %d: %s", id, err.Error())
18881887
return

0 commit comments

Comments
 (0)