diff options
Diffstat (limited to 'internal/testhelper/testhelper.go')
-rw-r--r-- | internal/testhelper/testhelper.go | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go index 30bd253ac..1c452e85a 100644 --- a/internal/testhelper/testhelper.go +++ b/internal/testhelper/testhelper.go @@ -1,5 +1,6 @@ package testhelper +//nolint: gci import ( "context" "crypto/ecdsa" @@ -30,8 +31,11 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/storage" "gitlab.com/gitlab-org/gitaly/v14/internal/helper/text" "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag" - "go.uber.org/goleak" "google.golang.org/grpc/metadata" + + // The goleak import only exists such that this test-only dependency is properly being + // attributed in our NOTICE file. + _ "go.uber.org/goleak" ) const ( @@ -43,14 +47,6 @@ const ( DefaultStorageName = "default" ) -// SkipWithPraefect skips the test if it is being executed with Praefect in front -// of the Gitaly. -func SkipWithPraefect(t testing.TB, reason string) { - if os.Getenv("GITALY_TEST_WITH_PRAEFECT") == "YesPlease" { - t.Skipf(reason) - } -} - // MustReadFile returns the content of a file or fails at once. func MustReadFile(t testing.TB, filename string) []byte { content, err := os.ReadFile(filename) @@ -165,18 +161,6 @@ func GetLocalhostListener(t testing.TB) (net.Listener, string) { return l, addr } -// MustHaveNoGoroutines panics if it finds any Goroutines running. -func MustHaveNoGoroutines() { - if err := goleak.Find( - // opencensus has a "defaultWorker" which is started by the package's - // `init()` function. There is no way to stop this worker, so it will leak - // whenever we import the package. - goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), - ); err != nil { - panic(fmt.Errorf("goroutines running: %w", err)) - } -} - // MustHaveNoChildProcess panics if it finds a running or finished child // process. It waits for 2 seconds for processes to be cleaned up by other // goroutines. |