Skip to content

Commit 14105ff

Browse files
authored
test: do not run memory race test in parallel (#17582)
Closes coder/internal#597 (comment) The parallelized tests share configs, which when accessed concurrently throw race errors. The configs are read only, so it is fine to run these tests with shared idp configs.
1 parent b9177ef commit 14105ff

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

coderd/idpsync/group_test.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ func TestParseGroupClaims(t *testing.T) {
6565
})
6666
}
6767

68+
//nolint:paralleltest, tparallel
6869
func TestGroupSyncTable(t *testing.T) {
6970
t.Parallel()
7071

@@ -248,9 +249,11 @@ func TestGroupSyncTable(t *testing.T) {
248249

249250
for _, tc := range testCases {
250251
tc := tc
252+
// The final test, "AllTogether", cannot run in parallel.
253+
// These tests are nearly instant using the memory db, so
254+
// this is still fast without being in parallel.
255+
//nolint:paralleltest, tparallel
251256
t.Run(tc.Name, func(t *testing.T) {
252-
t.Parallel()
253-
254257
db, _ := dbtestutil.NewDB(t)
255258
manager := runtimeconfig.NewManager()
256259
s := idpsync.NewAGPLSync(slogtest.Make(t, &slogtest.Options{}),
@@ -289,9 +292,8 @@ func TestGroupSyncTable(t *testing.T) {
289292
// deployment. This tests all organizations being synced together.
290293
// The reason we do them individually, is that it is much easier to
291294
// debug a single test case.
295+
//nolint:paralleltest, tparallel // This should run after all the individual tests
292296
t.Run("AllTogether", func(t *testing.T) {
293-
t.Parallel()
294-
295297
db, _ := dbtestutil.NewDB(t)
296298
manager := runtimeconfig.NewManager()
297299
s := idpsync.NewAGPLSync(slogtest.Make(t, &slogtest.Options{}),

coderd/idpsync/role_test.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/coder/coder/v2/testutil"
2424
)
2525

26+
//nolint:paralleltest, tparallel
2627
func TestRoleSyncTable(t *testing.T) {
2728
t.Parallel()
2829

@@ -190,9 +191,11 @@ func TestRoleSyncTable(t *testing.T) {
190191

191192
for _, tc := range testCases {
192193
tc := tc
194+
// The final test, "AllTogether", cannot run in parallel.
195+
// These tests are nearly instant using the memory db, so
196+
// this is still fast without being in parallel.
197+
//nolint:paralleltest, tparallel
193198
t.Run(tc.Name, func(t *testing.T) {
194-
t.Parallel()
195-
196199
db, _ := dbtestutil.NewDB(t)
197200
manager := runtimeconfig.NewManager()
198201
s := idpsync.NewAGPLSync(slogtest.Make(t, &slogtest.Options{

0 commit comments

Comments
 (0)