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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2020-11-12 15:28:28 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2020-11-17 10:07:45 +0300
commit3d2d90b0b58d9fea04f26eee3ca402e5fdb919f7 (patch)
tree91877812d33c18edf5ce8c389ca9640bf069618c /cmd/gitaly-git2go
parente8fb9cd8975f62ab91dd015c8eafaf98b71c8067 (diff)
tests: Unify test setup
There's been some proliferation in our test's main functions. Naturally enough, this causes some of them to not work correctly, e.g. because they use `defer` in the `TestMain` function, which is not getting executed if `os.Exit` is called. Unify existing setup functions to follow the same pattern, which is that `TestMain()` calls out to `testMain()`.
Diffstat (limited to 'cmd/gitaly-git2go')
-rw-r--r--cmd/gitaly-git2go/conflicts/conflicts_test.go6
-rw-r--r--cmd/gitaly-git2go/main_test.go6
2 files changed, 10 insertions, 2 deletions
diff --git a/cmd/gitaly-git2go/conflicts/conflicts_test.go b/cmd/gitaly-git2go/conflicts/conflicts_test.go
index f1bf44ed0..0dabd0d84 100644
--- a/cmd/gitaly-git2go/conflicts/conflicts_test.go
+++ b/cmd/gitaly-git2go/conflicts/conflicts_test.go
@@ -14,10 +14,14 @@ import (
)
func TestMain(m *testing.M) {
+ os.Exit(testMain(m))
+}
+
+func testMain(m *testing.M) int {
defer testhelper.MustHaveNoChildProcess()
testhelper.Configure()
testhelper.ConfigureGitalyGit2Go()
- os.Exit(m.Run())
+ return m.Run()
}
func TestConflicts(t *testing.T) {
diff --git a/cmd/gitaly-git2go/main_test.go b/cmd/gitaly-git2go/main_test.go
index e9552633b..fc4909771 100644
--- a/cmd/gitaly-git2go/main_test.go
+++ b/cmd/gitaly-git2go/main_test.go
@@ -10,8 +10,12 @@ import (
)
func TestMain(m *testing.M) {
+ os.Exit(testMain(m))
+}
+
+func testMain(m *testing.M) int {
defer testhelper.MustHaveNoChildProcess()
testhelper.Configure()
testhelper.ConfigureGitalyGit2Go()
- os.Exit(m.Run())
+ return m.Run()
}