diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2020-11-12 15:28:28 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2020-11-17 10:07:45 +0300 |
commit | 3d2d90b0b58d9fea04f26eee3ca402e5fdb919f7 (patch) | |
tree | 91877812d33c18edf5ce8c389ca9640bf069618c /internal/helper/repo_test.go | |
parent | e8fb9cd8975f62ab91dd015c8eafaf98b71c8067 (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 'internal/helper/repo_test.go')
-rw-r--r-- | internal/helper/repo_test.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/helper/repo_test.go b/internal/helper/repo_test.go index 937dbe064..17e2496bf 100644 --- a/internal/helper/repo_test.go +++ b/internal/helper/repo_test.go @@ -13,8 +13,13 @@ import ( ) func TestMain(m *testing.M) { + os.Exit(testMain(m)) +} + +func testMain(m *testing.M) int { + defer testhelper.MustHaveNoChildProcess() testhelper.Configure() - os.Exit(m.Run()) + return m.Run() } func TestRepoPathEqual(t *testing.T) { |