chore(testutil): add testutil.GoleakOptions (#16070)

- Adds `testutil.GoleakOptions` and consolidates existing options to
this location
- Pre-emptively adds required ignore for this Dependabot PR to pass CI
https://github.com/coder/coder/pull/16066
This commit is contained in:
Cian Johnston
2025-01-08 15:38:37 +00:00
committed by GitHub
parent 106b1cd3bc
commit 7b88776403
36 changed files with 60 additions and 43 deletions
+1 -1
View File
@@ -1256,5 +1256,5 @@ func mustWorkspaceParameters(t *testing.T, client *codersdk.Client, workspaceID
}
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
}
+1 -1
View File
@@ -122,5 +122,5 @@ func durations(ds ...time.Duration) []time.Duration {
}
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
}
+1 -1
View File
@@ -39,7 +39,7 @@ import (
var updateGoldenFiles = flag.Bool("update", false, "Update golden files")
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
}
func TestBuildInfo(t *testing.T) {
+2 -1
View File
@@ -6,10 +6,11 @@ import (
"go.uber.org/goleak"
"github.com/coder/coder/v2/coderd/coderdtest"
"github.com/coder/coder/v2/testutil"
)
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
}
func TestNew(t *testing.T) {
+1 -1
View File
@@ -18,7 +18,7 @@ import (
)
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
}
func TestCryptoKeyCache(t *testing.T) {
+1 -1
View File
@@ -34,7 +34,7 @@ import (
)
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
}
// Ensures no goroutines leak.
+1 -1
View File
@@ -23,7 +23,7 @@ import (
)
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
}
func TestRollup_Close(t *testing.T) {
+2 -1
View File
@@ -12,10 +12,11 @@ import (
"github.com/coder/coder/v2/coderd/database/dbtestutil"
"github.com/coder/coder/v2/coderd/database/migrations"
"github.com/coder/coder/v2/testutil"
)
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
}
func TestOpen(t *testing.T) {
+1 -1
View File
@@ -28,7 +28,7 @@ import (
)
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
}
func TestMigrate(t *testing.T) {
+1 -1
View File
@@ -26,7 +26,7 @@ import (
)
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
}
func TestSMTP(t *testing.T) {
+1 -1
View File
@@ -56,7 +56,7 @@ import (
var updateGoldenFiles = flag.Bool("update", false, "Update golden files")
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
}
// TestBasicNotificationRoundtrip enqueues a message to the store, waits for it to be acquired by a notifier,
+1 -1
View File
@@ -28,7 +28,7 @@ import (
)
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
}
// TestAcquirer_Store tests that a database.Store is accepted as a provisionerdserver.AcquirerStore
+1 -1
View File
@@ -27,7 +27,7 @@ import (
)
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
}
func TestTelemetry(t *testing.T) {
+1 -1
View File
@@ -28,7 +28,7 @@ import (
)
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
}
func TestDetectorNoJobs(t *testing.T) {
+1 -1
View File
@@ -154,5 +154,5 @@ func TestChecker_Latest(t *testing.T) {
}
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
}
+1 -1
View File
@@ -219,5 +219,5 @@ func TestTracker_MultipleInstances(t *testing.T) {
}
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
}