diff options
author | Will Chandler <wchandler@gitlab.com> | 2023-08-29 16:10:12 +0300 |
---|---|---|
committer | Will Chandler <wchandler@gitlab.com> | 2023-08-30 16:39:23 +0300 |
commit | 677d45ffc63859d9319b4d113e0b8bedd3959406 (patch) | |
tree | 8d9c18097de4ae75fadf5bd3bc9cfab230ec3c2a | |
parent | 4eed7c1ce988552463a16fa118181cb2d8cb5e9e (diff) |
Add missing TestMain calls
Many packages fail to call `TestMain` as part of their tests, which is
required to invoke our goroutine leak detector. Create a new
`testhelper_test.go` file and include a `TestMain` function that
executes `testhelper.Run`.
45 files changed, 488 insertions, 0 deletions
diff --git a/auth/testhelper_test.go b/auth/testhelper_test.go new file mode 100644 index 000000000..cb7efe000 --- /dev/null +++ b/auth/testhelper_test.go @@ -0,0 +1,11 @@ +package gitalyauth + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/cmd/gitaly-gpg/testhelper_test.go b/cmd/gitaly-gpg/testhelper_test.go new file mode 100644 index 000000000..432115dc0 --- /dev/null +++ b/cmd/gitaly-gpg/testhelper_test.go @@ -0,0 +1,11 @@ +package main + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/backoff/testhelper_test.go b/internal/backoff/testhelper_test.go new file mode 100644 index 000000000..cc3edbe5d --- /dev/null +++ b/internal/backoff/testhelper_test.go @@ -0,0 +1,11 @@ +package backoff + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/blackbox/testhelper_test.go b/internal/blackbox/testhelper_test.go new file mode 100644 index 000000000..e88e9446d --- /dev/null +++ b/internal/blackbox/testhelper_test.go @@ -0,0 +1,11 @@ +package blackbox + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/bootstrap/starter/testhelper_test.go b/internal/bootstrap/starter/testhelper_test.go new file mode 100644 index 000000000..ab294fdf6 --- /dev/null +++ b/internal/bootstrap/starter/testhelper_test.go @@ -0,0 +1,11 @@ +package starter + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/git/conflict/testhelper_test.go b/internal/git/conflict/testhelper_test.go new file mode 100644 index 000000000..2de131e4b --- /dev/null +++ b/internal/git/conflict/testhelper_test.go @@ -0,0 +1,11 @@ +package conflict + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/git/gitio/testhelper_test.go b/internal/git/gitio/testhelper_test.go new file mode 100644 index 000000000..39575eb47 --- /dev/null +++ b/internal/git/gitio/testhelper_test.go @@ -0,0 +1,11 @@ +package gitio + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/git/pktline/testhelper_test.go b/internal/git/pktline/testhelper_test.go new file mode 100644 index 000000000..528293c8c --- /dev/null +++ b/internal/git/pktline/testhelper_test.go @@ -0,0 +1,11 @@ +package pktline + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/git/rawdiff/testhelper_test.go b/internal/git/rawdiff/testhelper_test.go new file mode 100644 index 000000000..f52f567c2 --- /dev/null +++ b/internal/git/rawdiff/testhelper_test.go @@ -0,0 +1,11 @@ +package rawdiff + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/git/trace2/testhelper_test.go b/internal/git/trace2/testhelper_test.go new file mode 100644 index 000000000..4500d7404 --- /dev/null +++ b/internal/git/trace2/testhelper_test.go @@ -0,0 +1,11 @@ +package trace2 + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/git/trailerparser/testhelper_test.go b/internal/git/trailerparser/testhelper_test.go new file mode 100644 index 000000000..b26271c1a --- /dev/null +++ b/internal/git/trailerparser/testhelper_test.go @@ -0,0 +1,11 @@ +package trailerparser + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/gitaly/config/cgroups/testhelper_test.go b/internal/gitaly/config/cgroups/testhelper_test.go new file mode 100644 index 000000000..2eabe6510 --- /dev/null +++ b/internal/gitaly/config/cgroups/testhelper_test.go @@ -0,0 +1,11 @@ +package cgroups + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/gitaly/config/prometheus/testhelper_test.go b/internal/gitaly/config/prometheus/testhelper_test.go new file mode 100644 index 000000000..9653a830e --- /dev/null +++ b/internal/gitaly/config/prometheus/testhelper_test.go @@ -0,0 +1,11 @@ +package prometheus + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/gitaly/diff/testhelper_test.go b/internal/gitaly/diff/testhelper_test.go new file mode 100644 index 000000000..053cf6df0 --- /dev/null +++ b/internal/gitaly/diff/testhelper_test.go @@ -0,0 +1,11 @@ +package diff + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/gitlab/client/testhelper_test.go b/internal/gitlab/client/testhelper_test.go new file mode 100644 index 000000000..137104d4d --- /dev/null +++ b/internal/gitlab/client/testhelper_test.go @@ -0,0 +1,11 @@ +package client + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/grpc/backchannel/testhelper_test.go b/internal/grpc/backchannel/testhelper_test.go new file mode 100644 index 000000000..c2ba27cbb --- /dev/null +++ b/internal/grpc/backchannel/testhelper_test.go @@ -0,0 +1,11 @@ +package backchannel + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/grpc/client/testhelper_test.go b/internal/grpc/client/testhelper_test.go new file mode 100644 index 000000000..137104d4d --- /dev/null +++ b/internal/grpc/client/testhelper_test.go @@ -0,0 +1,11 @@ +package client + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/grpc/listenmux/testhelper_test.go b/internal/grpc/listenmux/testhelper_test.go new file mode 100644 index 000000000..3cd68209c --- /dev/null +++ b/internal/grpc/listenmux/testhelper_test.go @@ -0,0 +1,11 @@ +package listenmux + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/grpc/metadata/testhelper_test.go b/internal/grpc/metadata/testhelper_test.go new file mode 100644 index 000000000..bfb393903 --- /dev/null +++ b/internal/grpc/metadata/testhelper_test.go @@ -0,0 +1,11 @@ +package metadata + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/grpc/middleware/cache/testhelper_test.go b/internal/grpc/middleware/cache/testhelper_test.go new file mode 100644 index 000000000..6c55da37a --- /dev/null +++ b/internal/grpc/middleware/cache/testhelper_test.go @@ -0,0 +1,11 @@ +package cache + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/grpc/middleware/featureflag/testhelper_test.go b/internal/grpc/middleware/featureflag/testhelper_test.go new file mode 100644 index 000000000..3b7d11638 --- /dev/null +++ b/internal/grpc/middleware/featureflag/testhelper_test.go @@ -0,0 +1,11 @@ +package featureflag + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/grpc/middleware/metadatahandler/testhelper_test.go b/internal/grpc/middleware/metadatahandler/testhelper_test.go new file mode 100644 index 000000000..ee8340678 --- /dev/null +++ b/internal/grpc/middleware/metadatahandler/testhelper_test.go @@ -0,0 +1,11 @@ +package metadatahandler + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/grpc/middleware/sentryhandler/testhelper_test.go b/internal/grpc/middleware/sentryhandler/testhelper_test.go new file mode 100644 index 000000000..d9287d14e --- /dev/null +++ b/internal/grpc/middleware/sentryhandler/testhelper_test.go @@ -0,0 +1,11 @@ +package sentryhandler + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/grpc/middleware/statushandler/testhelper_test.go b/internal/grpc/middleware/statushandler/testhelper_test.go new file mode 100644 index 000000000..3437d6df2 --- /dev/null +++ b/internal/grpc/middleware/statushandler/testhelper_test.go @@ -0,0 +1,11 @@ +package statushandler + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/grpc/protoregistry/testhelper_test.go b/internal/grpc/protoregistry/testhelper_test.go new file mode 100644 index 000000000..07f146a30 --- /dev/null +++ b/internal/grpc/protoregistry/testhelper_test.go @@ -0,0 +1,11 @@ +package protoregistry + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/grpc/sidechannel/testhelper_test.go b/internal/grpc/sidechannel/testhelper_test.go new file mode 100644 index 000000000..746f17eba --- /dev/null +++ b/internal/grpc/sidechannel/testhelper_test.go @@ -0,0 +1,11 @@ +package sidechannel + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/helper/duration/testhelper_test.go b/internal/helper/duration/testhelper_test.go new file mode 100644 index 000000000..a0d9e8f7f --- /dev/null +++ b/internal/helper/duration/testhelper_test.go @@ -0,0 +1,11 @@ +package duration + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/helper/env/testhelper_test.go b/internal/helper/env/testhelper_test.go new file mode 100644 index 000000000..5fb46d8dc --- /dev/null +++ b/internal/helper/env/testhelper_test.go @@ -0,0 +1,11 @@ +package env_test + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/helper/fstype/testhelper_test.go b/internal/helper/fstype/testhelper_test.go new file mode 100644 index 000000000..10ba5c1a8 --- /dev/null +++ b/internal/helper/fstype/testhelper_test.go @@ -0,0 +1,11 @@ +package fstype + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/helper/lines/testhelper_test.go b/internal/helper/lines/testhelper_test.go new file mode 100644 index 000000000..c1230a761 --- /dev/null +++ b/internal/helper/lines/testhelper_test.go @@ -0,0 +1,11 @@ +package lines + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/helper/testhelper_test.go b/internal/helper/testhelper_test.go new file mode 100644 index 000000000..c57af0dad --- /dev/null +++ b/internal/helper/testhelper_test.go @@ -0,0 +1,11 @@ +package helper + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/limiter/testhelper_test.go b/internal/limiter/testhelper_test.go new file mode 100644 index 000000000..419ba2158 --- /dev/null +++ b/internal/limiter/testhelper_test.go @@ -0,0 +1,11 @@ +package limiter + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/limiter/watchers/testhelper_test.go b/internal/limiter/watchers/testhelper_test.go index 39cb89546..fa9539a20 100644 --- a/internal/limiter/watchers/testhelper_test.go +++ b/internal/limiter/watchers/testhelper_test.go @@ -2,9 +2,11 @@ package watchers import ( "os/exec" + "testing" "github.com/prometheus/client_golang/prometheus" "gitlab.com/gitlab-org/gitaly/v16/internal/cgroups" + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" ) type testCgroupManager struct { @@ -14,6 +16,10 @@ type testCgroupManager struct { statsIndex int } +func TestMain(m *testing.M) { + testhelper.Run(m) +} + func (m *testCgroupManager) Ready() bool { return m.ready } func (m *testCgroupManager) Stats() (cgroups.Stats, error) { m.statsIndex++ diff --git a/internal/praefect/metrics/testhelper_test.go b/internal/praefect/metrics/testhelper_test.go new file mode 100644 index 000000000..843d467d4 --- /dev/null +++ b/internal/praefect/metrics/testhelper_test.go @@ -0,0 +1,11 @@ +package metrics + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/praefect/nodes/tracker/testhelper_test.go b/internal/praefect/nodes/tracker/testhelper_test.go new file mode 100644 index 000000000..aabde6553 --- /dev/null +++ b/internal/praefect/nodes/tracker/testhelper_test.go @@ -0,0 +1,11 @@ +package tracker + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/praefect/reconciler/testhelper_test.go b/internal/praefect/reconciler/testhelper_test.go new file mode 100644 index 000000000..d489e2e02 --- /dev/null +++ b/internal/praefect/reconciler/testhelper_test.go @@ -0,0 +1,11 @@ +package reconciler + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/praefect/transactions/testhelper_test.go b/internal/praefect/transactions/testhelper_test.go new file mode 100644 index 000000000..cdc7934b9 --- /dev/null +++ b/internal/praefect/transactions/testhelper_test.go @@ -0,0 +1,11 @@ +package transactions + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/ps/testhelper_test.go b/internal/ps/testhelper_test.go new file mode 100644 index 000000000..86cb86e6d --- /dev/null +++ b/internal/ps/testhelper_test.go @@ -0,0 +1,11 @@ +package ps + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/signature/testhelper_test.go b/internal/signature/testhelper_test.go new file mode 100644 index 000000000..52b02e6da --- /dev/null +++ b/internal/signature/testhelper_test.go @@ -0,0 +1,11 @@ +package signature + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/testhelper/testdb/testhelper_test.go b/internal/testhelper/testdb/testhelper_test.go new file mode 100644 index 000000000..124932072 --- /dev/null +++ b/internal/testhelper/testdb/testhelper_test.go @@ -0,0 +1,11 @@ +package testdb + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/testhelper/testhelper_test.go b/internal/testhelper/testhelper_test.go new file mode 100644 index 000000000..a91779dd4 --- /dev/null +++ b/internal/testhelper/testhelper_test.go @@ -0,0 +1,9 @@ +package testhelper + +import ( + "testing" +) + +func TestMain(m *testing.M) { + Run(m) +} diff --git a/internal/testhelper/testserver/testhelper_test.go b/internal/testhelper/testserver/testhelper_test.go new file mode 100644 index 000000000..d09ca3b54 --- /dev/null +++ b/internal/testhelper/testserver/testhelper_test.go @@ -0,0 +1,11 @@ +package testserver + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/internal/tracing/testhelper_test.go b/internal/tracing/testhelper_test.go new file mode 100644 index 000000000..f940df2d1 --- /dev/null +++ b/internal/tracing/testhelper_test.go @@ -0,0 +1,11 @@ +package tracing + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/streamio/testhelper_test.go b/streamio/testhelper_test.go new file mode 100644 index 000000000..2edd01de6 --- /dev/null +++ b/streamio/testhelper_test.go @@ -0,0 +1,11 @@ +package streamio + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} diff --git a/testhelper_test.go b/testhelper_test.go new file mode 100644 index 000000000..0aa8282d5 --- /dev/null +++ b/testhelper_test.go @@ -0,0 +1,11 @@ +package gitaly + +import ( + "testing" + + "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" +) + +func TestMain(m *testing.M) { + testhelper.Run(m) +} |