diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2022-10-26 13:50:57 +0300 |
---|---|---|
committer | Pavlo Strokov <pstrokov@gitlab.com> | 2022-10-31 10:15:08 +0300 |
commit | 8df495a910e1465e3c2ff53b4d33c1131398b8ea (patch) | |
tree | beeabda3f31c741d0e321b67e010cb998d2a7e6c | |
parent | 0c517dcb6f7600afcd58f1c89a2d407b7f56b5a0 (diff) |
housekeeping: Parallelize test executionps-houskeeping-fixes
After applying `t.Parallel()` to the tests it reduces
time to run the tests on my local. It should reduce
time to run the tests on the CI as well.
-rw-r--r-- | internal/git/housekeeping/clean_stale_data_test.go | 9 | ||||
-rw-r--r-- | internal/git/housekeeping/object_pool_test.go | 1 | ||||
-rw-r--r-- | internal/git/housekeeping/optimize_repository_test.go | 2 |
3 files changed, 12 insertions, 0 deletions
diff --git a/internal/git/housekeeping/clean_stale_data_test.go b/internal/git/housekeeping/clean_stale_data_test.go index b030bf385..300ceed55 100644 --- a/internal/git/housekeeping/clean_stale_data_test.go +++ b/internal/git/housekeeping/clean_stale_data_test.go @@ -177,6 +177,7 @@ func requireCleanStaleDataMetrics(t *testing.T, m *RepositoryManager, metrics cl } func TestRepositoryManager_CleanStaleData(t *testing.T) { + t.Parallel() testcases := []struct { name string entries []entry @@ -301,6 +302,7 @@ func TestRepositoryManager_CleanStaleData(t *testing.T) { } func TestRepositoryManager_CleanStaleData_references(t *testing.T) { + t.Parallel() type ref struct { name string age time.Duration @@ -405,6 +407,7 @@ func TestRepositoryManager_CleanStaleData_references(t *testing.T) { } func TestRepositoryManager_CleanStaleData_emptyRefDirs(t *testing.T) { + t.Parallel() testcases := []struct { name string entries []entry @@ -681,6 +684,7 @@ func TestRepositoryManager_CleanStaleData_withSpecificFile(t *testing.T) { } func TestRepositoryManager_CleanStaleData_serverInfo(t *testing.T) { + t.Parallel() ctx := testhelper.Context(t) cfg, repoProto, repoPath := testcfg.BuildWithRepo(t) @@ -730,6 +734,7 @@ func TestRepositoryManager_CleanStaleData_serverInfo(t *testing.T) { } func TestRepositoryManager_CleanStaleData_referenceLocks(t *testing.T) { + t.Parallel() ctx := testhelper.Context(t) for _, tc := range []struct { @@ -791,6 +796,7 @@ func TestRepositoryManager_CleanStaleData_referenceLocks(t *testing.T) { }, } { t.Run(tc.desc, func(t *testing.T) { + t.Parallel() cfg, repoProto, repoPath := testcfg.BuildWithRepo(t) repo := localrepo.NewTestRepo(t, cfg, repoProto) @@ -852,6 +858,7 @@ func (m mockFileInfo) ModTime() time.Time { } func TestIsStaleTemporaryObject(t *testing.T) { + t.Parallel() for _, tc := range []struct { name string dirEntry fs.DirEntry @@ -908,6 +915,7 @@ func TestIsStaleTemporaryObject(t *testing.T) { } func TestRepositoryManager_CleanStaleData_missingRepo(t *testing.T) { + t.Parallel() cfg, repoProto, repoPath := testcfg.BuildWithRepo(t) repo := localrepo.NewTestRepo(t, cfg, repoProto) ctx := testhelper.Context(t) @@ -918,6 +926,7 @@ func TestRepositoryManager_CleanStaleData_missingRepo(t *testing.T) { } func TestRepositoryManager_CleanStaleData_unsetConfiguration(t *testing.T) { + t.Parallel() ctx := testhelper.Context(t) cfg := testcfg.Build(t) diff --git a/internal/git/housekeeping/object_pool_test.go b/internal/git/housekeeping/object_pool_test.go index daf134505..eabbabc62 100644 --- a/internal/git/housekeeping/object_pool_test.go +++ b/internal/git/housekeeping/object_pool_test.go @@ -10,6 +10,7 @@ import ( ) func TestIsPoolRepository(t *testing.T) { + t.Parallel() for _, tc := range []struct { desc string repo *gitalypb.Repository diff --git a/internal/git/housekeeping/optimize_repository_test.go b/internal/git/housekeeping/optimize_repository_test.go index a43d544c0..3500b8986 100644 --- a/internal/git/housekeeping/optimize_repository_test.go +++ b/internal/git/housekeeping/optimize_repository_test.go @@ -152,6 +152,7 @@ func TestPackRefsIfNeeded(t *testing.T) { } func TestOptimizeRepository(t *testing.T) { + t.Parallel() ctx := testhelper.Context(t) cfg := testcfg.Build(t) @@ -383,6 +384,7 @@ gitaly_housekeeping_tasks_total{housekeeping_task="total", status="success"} 1 } func TestOptimizeRepository_ConcurrencyLimit(t *testing.T) { + t.Parallel() ctx := testhelper.Context(t) cfg := testcfg.Build(t) |