diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-07-08 15:19:33 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-07-08 16:06:52 +0300 |
commit | 53944694cec4277da2a4354af4f1d197edeef8d4 (patch) | |
tree | fd8caf8084763fa91de6424d0cd0eee1be5ba8fb | |
parent | 88f78ed883808636f3ee02601ee37f944c82b07e (diff) |
updateref: Skip known-flaky test with Git v2.33.0pks-updateref-skip-flaky-test-with-git-v2.33.0
Git v2.33.0 had a bug in git-update-ref(1) where it didn't know to flush
its output correctly. As a result we cannot be sure that references have
been locked when calling `updateref.Prepare()` because we don't get a
confirmation from Git. We have since upstreamed a fix for this bug which
works as expected, but one of our tests is still frequently failing
because of exactly that bug when running with Git v2.33.0.
Skip this test to reduce flakiness of our pipelines. We know it's an
issue, we have a fix for it, and we want to upgrade the minimum required
Git version anyway. So there is not much of a point to continue hitting
this flake.
-rw-r--r-- | internal/git/updateref/updateref_test.go | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/internal/git/updateref/updateref_test.go b/internal/git/updateref/updateref_test.go index 692493d27..743e215a8 100644 --- a/internal/git/updateref/updateref_test.go +++ b/internal/git/updateref/updateref_test.go @@ -122,9 +122,14 @@ func TestUpdater_prepareLocksTransaction(t *testing.T) { func TestUpdater_concurrentLocking(t *testing.T) { t.Parallel() - ctx := testhelper.Context(t) cfg, protoRepo, _ := testcfg.BuildWithRepo(t) + ctx := testhelper.Context(t) + + if !gitSupportsStatusFlushing(t, ctx, cfg) { + t.Skip("git does not support flushing yet, which is known to be flaky") + } + repo := localrepo.NewTestRepo(t, cfg, protoRepo, git.WithSkipHooks()) commit, logErr := repo.ReadCommit(ctx, "refs/heads/master") @@ -139,22 +144,11 @@ func TestUpdater_concurrentLocking(t *testing.T) { require.NoError(t, err) require.NoError(t, secondUpdater.Update("refs/heads/master", "", commit.Id)) - // With flushing, we're able to detect concurrent locking at prepare time already instead of - // at commit time. - if gitSupportsStatusFlushing(t, ctx, cfg) { - err := secondUpdater.Prepare() - require.Error(t, err) - require.Contains(t, err.Error(), "fatal: prepare: cannot lock ref 'refs/heads/master'") - - require.NoError(t, firstUpdater.Commit()) - } else { - require.NoError(t, secondUpdater.Prepare()) - require.NoError(t, firstUpdater.Commit()) + err = secondUpdater.Prepare() + require.Error(t, err) + require.Contains(t, err.Error(), "fatal: prepare: cannot lock ref 'refs/heads/master'") - err := secondUpdater.Commit() - require.Error(t, err) - require.Contains(t, err.Error(), "fatal: prepare: cannot lock ref 'refs/heads/master'") - } + require.NoError(t, firstUpdater.Commit()) } func TestBulkOperation(t *testing.T) { |