From 3da6d256f47604fc5b8f3b63d595d8e230c8ffae Mon Sep 17 00:00:00 2001 From: zeripath Date: Sun, 8 Dec 2019 01:14:50 +0000 Subject: [PATCH] Missed defer prepareTestEnv (#9285) * onGiteaRun should defer the cleanup from prepareTestEnv * Some more missed defers --- integrations/benchmarks_test.go | 4 ++-- integrations/git_helper_for_declarative_test.go | 2 +- integrations/gpg_git_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integrations/benchmarks_test.go b/integrations/benchmarks_test.go index 4be3008f52..7c7aff994e 100644 --- a/integrations/benchmarks_test.go +++ b/integrations/benchmarks_test.go @@ -25,7 +25,7 @@ func BenchmarkRepo(b *testing.B) { {url: "https://github.com/golang/go.git", name: "go", skipShort: true}, {url: "https://github.com/torvalds/linux.git", name: "linux", skipShort: true}, } - prepareTestEnv(b) + defer prepareTestEnv(b)() session := loginUser(b, "user2") b.ResetTimer() @@ -75,7 +75,7 @@ func StringWithCharset(length int, charset string) string { func BenchmarkRepoBranchCommit(b *testing.B) { samples := []int64{1, 3, 15, 16} - prepareTestEnv(b) + defer prepareTestEnv(b)() b.ResetTimer() for _, repoID := range samples { diff --git a/integrations/git_helper_for_declarative_test.go b/integrations/git_helper_for_declarative_test.go index 1eb1f1dc8b..b334c55d3c 100644 --- a/integrations/git_helper_for_declarative_test.go +++ b/integrations/git_helper_for_declarative_test.go @@ -78,7 +78,7 @@ func allowLFSFilters() []string { func onGiteaRun(t *testing.T, callback func(*testing.T, *url.URL), prepare ...bool) { if len(prepare) == 0 || prepare[0] { - prepareTestEnv(t, 1) + defer prepareTestEnv(t, 1)() } s := http.Server{ Handler: mac, diff --git a/integrations/gpg_git_test.go b/integrations/gpg_git_test.go index 6c9b7c00ff..a31dec29bb 100644 --- a/integrations/gpg_git_test.go +++ b/integrations/gpg_git_test.go @@ -23,7 +23,7 @@ import ( ) func TestGPGGit(t *testing.T) { - prepareTestEnv(t) + defer prepareTestEnv(t)() username := "user2" // OK Set a new GPG home