diff options
author | Will Chandler <wchandler@gitlab.com> | 2022-09-23 23:12:19 +0300 |
---|---|---|
committer | Will Chandler <wchandler@gitlab.com> | 2022-09-28 17:50:10 +0300 |
commit | d08e0fe0028a6b52d597e854bd467331d442cad9 (patch) | |
tree | 96fce5642174264fef4ec1f2a9af8644f28b6015 | |
parent | 73b67f40f9418899f26117da808839e13936be7c (diff) |
praefect: run track-repositories tests seriallywc/track-repos-logger-race
The `praefect` command has a global logger that is passed to any
subcommands executed. When executing normally this is fine as each
process will only run a single subcommand. However, in testing this
creates a risk of race conditions when tests are run in parallel, as
each test goroutine will share this logger.
To resolve race detector failures on `TestAddRepositories_Exec()` and
`TestAddRepositories_Exec()`, we will now run these tests serially. This
has minimal impact on test execution time, increasing from 4.663s to
5.129s.
In the medium-term we should replace the global logger with a local that
allows parallel testing. Issue #4500[0] has been opened for this.
[0] https://gitlab.com/gitlab-org/gitaly/-/issues/4500
-rw-r--r-- | cmd/praefect/subcmd_track_repositories_test.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd/praefect/subcmd_track_repositories_test.go b/cmd/praefect/subcmd_track_repositories_test.go index c644f88d2..ed9737864 100644 --- a/cmd/praefect/subcmd_track_repositories_test.go +++ b/cmd/praefect/subcmd_track_repositories_test.go @@ -37,8 +37,9 @@ func TestAddRepositories_FlagSet(t *testing.T) { require.Equal(t, true, cmd.replicateImmediately) } +// Cannot be run with t.Parallel() due to races on global logger +// Cleanup tracked under https://gitlab.com/gitlab-org/gitaly/-/issues/4500 func TestAddRepositories_Exec_invalidInput(t *testing.T) { - t.Parallel() g1Cfg := testcfg.Build(t, testcfg.WithStorages("gitaly-1")) g2Cfg := testcfg.Build(t, testcfg.WithStorages("gitaly-2")) @@ -194,8 +195,9 @@ func TestAddRepositories_Exec_invalidInput(t *testing.T) { } } +// Cannot be run with t.Parallel() due to races on global logger +// Cleanup tracked under https://gitlab.com/gitlab-org/gitaly/-/issues/4500 func TestAddRepositories_Exec(t *testing.T) { - t.Parallel() g1Cfg := testcfg.Build(t, testcfg.WithStorages("gitaly-1")) g2Cfg := testcfg.Build(t, testcfg.WithStorages("gitaly-2")) testcfg.BuildGitalyHooks(t, g2Cfg) |