From d3dbdbe6c5abbc0d3a6a342f3a29d3895fad1270 Mon Sep 17 00:00:00 2001 From: zeripath Date: Sun, 27 Mar 2022 22:54:51 +0100 Subject: [PATCH] Prevent intermittent failures in RepoIndexerTest (2) (#19229) So whilst #19225 fixes one issue it caused another. We need to initialise the Git module first. Related #19225 Fix #19162 Signed-off-by: Andrew Thornton Co-authored-by: 6543 <6543@obermui.de> --- modules/indexer/stats/indexer_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/indexer/stats/indexer_test.go b/modules/indexer/stats/indexer_test.go index 03b5e61fdc..b5c58ab25a 100644 --- a/modules/indexer/stats/indexer_test.go +++ b/modules/indexer/stats/indexer_test.go @@ -12,6 +12,7 @@ import ( repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unittest" + "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/queue" "code.gitea.io/gitea/modules/setting" @@ -26,6 +27,10 @@ func TestMain(m *testing.M) { } func TestRepoStatsIndex(t *testing.T) { + if err := git.Init(context.Background()); !assert.NoError(t, err) { + return + } + assert.NoError(t, unittest.PrepareTestDatabase()) setting.Cfg = ini.Empty()