Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Chandler <wchandler@gitlab.com>2023-09-01 22:13:44 +0300
committerWill Chandler <wchandler@gitlab.com>2023-09-05 21:04:24 +0300
commit29ad514a8969545fb3ff31623abd52616652c38f (patch)
tree69202d873b9f68c1d6c45394b803452dffaa4cd4
parentbda5c66c7a4207b1bfae779f367eba0776873cd5 (diff)
Move TestMain into testhelper in _test packages
Our `TestMain` linter previously had a limitation that prevented it from checking that blackbox testing packages, ones ending in `_test`, contained a `TestMain` function. Generally this is not an issue as most packages has tests in their primary package, but `internal/git/packfile` and `internal/grpc/middleware/limithandler` are exceptions. Update these packages to move `TestMain` into `testhelper_test.go`.
-rw-r--r--internal/git/packfile/packfile_test.go4
-rw-r--r--internal/git/packfile/testhelper_test.go11
-rw-r--r--internal/grpc/middleware/limithandler/middleware_test.go4
-rw-r--r--internal/grpc/middleware/limithandler/testhelper_test.go6
4 files changed, 17 insertions, 8 deletions
diff --git a/internal/git/packfile/packfile_test.go b/internal/git/packfile/packfile_test.go
index 7605db79d..1c87407fa 100644
--- a/internal/git/packfile/packfile_test.go
+++ b/internal/git/packfile/packfile_test.go
@@ -11,10 +11,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v16/internal/testhelper/testcfg"
)
-func TestMain(m *testing.M) {
- testhelper.Run(m)
-}
-
func TestList(t *testing.T) {
t.Parallel()
diff --git a/internal/git/packfile/testhelper_test.go b/internal/git/packfile/testhelper_test.go
new file mode 100644
index 000000000..5c11ab605
--- /dev/null
+++ b/internal/git/packfile/testhelper_test.go
@@ -0,0 +1,11 @@
+package packfile_test
+
+import (
+ "testing"
+
+ "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper"
+)
+
+func TestMain(m *testing.M) {
+ testhelper.Run(m)
+}
diff --git a/internal/grpc/middleware/limithandler/middleware_test.go b/internal/grpc/middleware/limithandler/middleware_test.go
index 65adad2be..b12748582 100644
--- a/internal/grpc/middleware/limithandler/middleware_test.go
+++ b/internal/grpc/middleware/limithandler/middleware_test.go
@@ -27,10 +27,6 @@ import (
"google.golang.org/protobuf/types/known/durationpb"
)
-func TestMain(m *testing.M) {
- testhelper.Run(m)
-}
-
func fixedLockKey(ctx context.Context) string {
return "fixed-id"
}
diff --git a/internal/grpc/middleware/limithandler/testhelper_test.go b/internal/grpc/middleware/limithandler/testhelper_test.go
index 137c47cce..c32e97579 100644
--- a/internal/grpc/middleware/limithandler/testhelper_test.go
+++ b/internal/grpc/middleware/limithandler/testhelper_test.go
@@ -4,7 +4,9 @@ import (
"context"
"io"
"sync/atomic"
+ "testing"
+ "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper"
"google.golang.org/grpc/interop/grpc_testing"
)
@@ -14,6 +16,10 @@ type server struct {
blockCh chan struct{}
}
+func TestMain(m *testing.M) {
+ testhelper.Run(m)
+}
+
func (s *server) registerRequest() {
atomic.AddUint64(&s.requestCount, 1)
}