Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2021-04-28 21:15:00 +0300
committerToon Claes <toon@gitlab.com>2021-04-28 21:15:00 +0300
commit76be441c65a48b106fdfc06aa35c0d15bdf13b9b (patch)
treee7860111e41b5bb69f380f471c5cce4e8377d50f
parent34b2ac334944beb72e5000d9e90e5b7bdd4778fc (diff)
parent129d9e1085b93720a0ada8e8cfc2c37700fcdbcb (diff)
Merge branch 'pks-fix-flaky-user-rebase-confirmable-test' into 'master'
operations: Fix flaky UserRebaseConfirmable tests See merge request gitlab-org/gitaly!3421
-rw-r--r--internal/gitaly/service/operations/rebase_test.go45
1 files changed, 16 insertions, 29 deletions
diff --git a/internal/gitaly/service/operations/rebase_test.go b/internal/gitaly/service/operations/rebase_test.go
index abe28c079..7724acefb 100644
--- a/internal/gitaly/service/operations/rebase_test.go
+++ b/internal/gitaly/service/operations/rebase_test.go
@@ -5,6 +5,7 @@ package operations
import (
"context"
"fmt"
+ "io"
"strings"
"testing"
"time"
@@ -69,10 +70,8 @@ func testSuccessfulUserRebaseConfirmableRequestFeatured(t *testing.T, ctx contex
secondResponse, err := rebaseStream.Recv()
require.NoError(t, err, "receive second response")
- testhelper.ReceiveEOFWithTimeout(t, func() error {
- _, err = rebaseStream.Recv()
- return err
- })
+ _, err = rebaseStream.Recv()
+ require.Equal(t, io.EOF, err)
newBranchSha := getBranchSha(t, repoPath, rebaseBranchName)
@@ -175,11 +174,9 @@ func testUserRebaseConfirmableTransactionFeatured(t *testing.T, ctx context.Cont
require.NoError(t, err)
require.True(t, secondResponse.GetRebaseApplied(), "the second rebase is applied")
- testhelper.ReceiveEOFWithTimeout(t, func() error {
- response, err := rebaseStream.Recv()
- require.Nil(t, response)
- return err
- })
+ response, err := rebaseStream.Recv()
+ require.Nil(t, response)
+ require.Equal(t, io.EOF, err)
require.Equal(t, tc.expectedVotes, voteCount)
if tc.expectPreReceiveHook {
@@ -233,10 +230,8 @@ func testUserRebaseConfirmableStableCommitIDsFeatured(t *testing.T, ctx context.
require.NoError(t, err, "receive second response")
require.True(t, response.GetRebaseApplied())
- testhelper.ReceiveEOFWithTimeout(t, func() error {
- _, err = rebaseStream.Recv()
- return err
- })
+ _, err = rebaseStream.Recv()
+ require.Equal(t, io.EOF, err)
commit, err := repo.ReadCommit(ctx, git.Revision(rebaseBranchName))
require.NoError(t, err, "look up git commit")
@@ -465,10 +460,8 @@ func testFailedUserRebaseConfirmableRequestDueToPreReceiveErrorFeatured(t *testi
require.NoError(t, err, "receive second response")
require.Contains(t, secondResponse.PreReceiveError, "failure")
- testhelper.ReceiveEOFWithTimeout(t, func() error {
- _, err = rebaseStream.Recv()
- return err
- })
+ _, err = rebaseStream.Recv()
+ require.Equal(t, io.EOF, err)
newBranchSha := getBranchSha(t, repoPath, rebaseBranchName)
require.Equal(t, branchSha, newBranchSha, "branch should not change when the rebase fails due to PreReceiveError")
@@ -500,10 +493,8 @@ func testFailedUserRebaseConfirmableDueToGitErrorFeatured(t *testing.T, ctx cont
require.NoError(t, err, "receive first response")
require.Contains(t, firstResponse.GitError, "conflict")
- testhelper.ReceiveEOFWithTimeout(t, func() error {
- _, err = rebaseStream.Recv()
- return err
- })
+ _, err = rebaseStream.Recv()
+ require.Equal(t, io.EOF, err)
newBranchSha := getBranchSha(t, repoPath, failedBranchName)
require.Equal(t, branchSha, newBranchSha, "branch should not change when the rebase fails due to GitError")
@@ -556,10 +547,8 @@ func testRebaseRequestWithDeletedFileFeatured(t *testing.T, ctx context.Context,
secondResponse, err := rebaseStream.Recv()
require.NoError(t, err, "receive second response")
- testhelper.ReceiveEOFWithTimeout(t, func() error {
- _, err = rebaseStream.Recv()
- return err
- })
+ _, err = rebaseStream.Recv()
+ require.Equal(t, io.EOF, err)
newBranchSha := getBranchSha(t, repoPath, branch)
@@ -613,10 +602,8 @@ func testRebaseOntoRemoteBranchFeatured(t *testing.T, ctx context.Context, cfg c
secondResponse, err := rebaseStream.Recv()
require.NoError(t, err, "receive second response")
- testhelper.ReceiveEOFWithTimeout(t, func() error {
- _, err = rebaseStream.Recv()
- return err
- })
+ _, err = rebaseStream.Recv()
+ require.Equal(t, io.EOF, err)
rebasedBranchHash := getBranchSha(t, repoPath, localBranch)