You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
flake: TestAIGatewayKeysTableConstraints (race on shared err) #25979
err is declared once in the outer test function at coderd/database/querier_test.go:14749 (_, err := db.InsertAIGatewayKey(ctx, preExsiting)) and then reassigned with = inside each parallel subtest at line 14831:
All parallel subtests share the outer err. The race detector report points exactly at this:
WARNING: DATA RACE
Write at 0x00c000dc2ad0 by goroutine 855:
...TestAIGatewayKeysTableConstraints.func1()
coderd/database/querier_test.go:14831 +0x144
Previous read at 0x00c000dc2ad0 by goroutine 846:
...TestAIGatewayKeysTableConstraints.func1()
coderd/database/querier_test.go:14833 +0x1c7
Fix
Change _, err = ... to _, err := ... on line 14831 so each subtest gets its own err.
Activity
test: data race for TestAIGatewayKeysTableConstraints - shadowed error (