From ac7399abd3174a8a91e6425289b1074dc7720fa6 Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Mon, 28 Apr 2025 08:54:21 -0500 Subject: [PATCH 1/4] test: do not run memory race test in parallel --- coderd/idpsync/role_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/coderd/idpsync/role_test.go b/coderd/idpsync/role_test.go index d766ada6057f7..27da950d3697f 100644 --- a/coderd/idpsync/role_test.go +++ b/coderd/idpsync/role_test.go @@ -190,9 +190,11 @@ func TestRoleSyncTable(t *testing.T) { for _, tc := range testCases { tc := tc + // The final test, "AllTogether", cannot run in parallel. + // These tests are nearly instant using the memory db, so + // this is still fast without being in parallel. + //nolint:paralleltest, tparallel t.Run(tc.Name, func(t *testing.T) { - t.Parallel() - db, _ := dbtestutil.NewDB(t) manager := runtimeconfig.NewManager() s := idpsync.NewAGPLSync(slogtest.Make(t, &slogtest.Options{ From cd90dff574ff661b5f75ac7c6b51c99c5247b32e Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Mon, 28 Apr 2025 11:41:14 -0500 Subject: [PATCH 2/4] remove some parallel tests --- coderd/idpsync/group_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/coderd/idpsync/group_test.go b/coderd/idpsync/group_test.go index 4a892964a9aa7..f4f5f02466ec6 100644 --- a/coderd/idpsync/group_test.go +++ b/coderd/idpsync/group_test.go @@ -248,8 +248,11 @@ func TestGroupSyncTable(t *testing.T) { for _, tc := range testCases { tc := tc + // The final test, "AllTogether", cannot run in parallel. + // These tests are nearly instant using the memory db, so + // this is still fast without being in parallel. + //nolint:paralleltest, tparallel t.Run(tc.Name, func(t *testing.T) { - t.Parallel() db, _ := dbtestutil.NewDB(t) manager := runtimeconfig.NewManager() @@ -289,8 +292,8 @@ func TestGroupSyncTable(t *testing.T) { // deployment. This tests all organizations being synced together. // The reason we do them individually, is that it is much easier to // debug a single test case. + //nolint:paralleltest, tparallel // This should run after all the individual tests t.Run("AllTogether", func(t *testing.T) { - t.Parallel() db, _ := dbtestutil.NewDB(t) manager := runtimeconfig.NewManager() From 00fff8c1dd926d9dc988dcde0c736e58cd31a29d Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Mon, 28 Apr 2025 11:44:23 -0500 Subject: [PATCH 3/4] fmt --- coderd/idpsync/group_test.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/coderd/idpsync/group_test.go b/coderd/idpsync/group_test.go index f4f5f02466ec6..5bb04f9ca0b7f 100644 --- a/coderd/idpsync/group_test.go +++ b/coderd/idpsync/group_test.go @@ -253,7 +253,6 @@ func TestGroupSyncTable(t *testing.T) { // this is still fast without being in parallel. //nolint:paralleltest, tparallel t.Run(tc.Name, func(t *testing.T) { - db, _ := dbtestutil.NewDB(t) manager := runtimeconfig.NewManager() s := idpsync.NewAGPLSync(slogtest.Make(t, &slogtest.Options{}), @@ -294,7 +293,6 @@ func TestGroupSyncTable(t *testing.T) { // debug a single test case. //nolint:paralleltest, tparallel // This should run after all the individual tests t.Run("AllTogether", func(t *testing.T) { - db, _ := dbtestutil.NewDB(t) manager := runtimeconfig.NewManager() s := idpsync.NewAGPLSync(slogtest.Make(t, &slogtest.Options{}), From 48678b6b753813c13bdb9f80932bb4b6daad8e27 Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Mon, 28 Apr 2025 12:03:53 -0500 Subject: [PATCH 4/4] linting --- coderd/idpsync/group_test.go | 1 + coderd/idpsync/role_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/coderd/idpsync/group_test.go b/coderd/idpsync/group_test.go index 5bb04f9ca0b7f..58024ed2f6f8f 100644 --- a/coderd/idpsync/group_test.go +++ b/coderd/idpsync/group_test.go @@ -65,6 +65,7 @@ func TestParseGroupClaims(t *testing.T) { }) } +//nolint:paralleltest, tparallel func TestGroupSyncTable(t *testing.T) { t.Parallel() diff --git a/coderd/idpsync/role_test.go b/coderd/idpsync/role_test.go index 27da950d3697f..f1cebc1884453 100644 --- a/coderd/idpsync/role_test.go +++ b/coderd/idpsync/role_test.go @@ -23,6 +23,7 @@ import ( "github.com/coder/coder/v2/testutil" ) +//nolint:paralleltest, tparallel func TestRoleSyncTable(t *testing.T) { t.Parallel()