From 169ca21e6d52d6e6548a6d8e51d11021fff6a246 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Thu, 12 Nov 2020 13:09:36 +0100 Subject: testhelper: Have Configure() return cleanup function During tests we're accumulating quite some global data, some of which is hard to clean up separately. As we don't have any shared global test directory in which we can put all generated test data, they're thus all over `/tmp` and never get cleaned up. As a result, after a few runs the temporary directory will be cluttered by thousands of files and directories generated by our test suite. This commit is a preparation for such a global unified test directory, which is going to be set up by `testhelper.Configure()`. In order to assure it'll get cleaned up, we add a (still empty) cleanup function and adjust all callers to invoke it. This function will at a later point be used to delete the temporary test directory. --- internal/git2go/commit_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'internal/git2go') diff --git a/internal/git2go/commit_test.go b/internal/git2go/commit_test.go index 7bba3aa31..1d00c526d 100644 --- a/internal/git2go/commit_test.go +++ b/internal/git2go/commit_test.go @@ -24,7 +24,8 @@ func TestMain(m *testing.M) { func testMain(m *testing.M) int { defer testhelper.MustHaveNoChildProcess() - testhelper.Configure() + cleanup := testhelper.Configure() + defer cleanup() testhelper.ConfigureGitalyGit2Go() return m.Run() } -- cgit v1.2.3