From 53944694cec4277da2a4354af4f1d197edeef8d4 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Fri, 8 Jul 2022 14:19:33 +0200 Subject: updateref: Skip known-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. --- internal/git/updateref/updateref_test.go | 26 ++++++++++---------------- 1 file 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) { -- cgit v1.2.3