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:
authorSami Hiltunen <shiltunen@gitlab.com>2022-05-19 12:35:55 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2022-05-19 12:35:55 +0300
commitdc89f1ebfddca732f55d74488f94a6ed25444b07 (patch)
treea23b3de260c9e6d88f3a1d8f8e9400665abc52e4
parent02630a2c8dbd8b00c6f3aad2f3c3adb6777b394c (diff)
parent1fba2d9e14873c8061c4c56d525525553b7cf71f (diff)
Merge branch 'pks-operations-fix-flaky-apply-patch-test' into 'master'
operations: Fix flaky test for known-to-fail requests in UserApplyPatch Closes #4161 See merge request gitlab-org/gitaly!4573
-rw-r--r--internal/gitaly/service/operations/apply_patch_test.go20
1 files changed, 18 insertions, 2 deletions
diff --git a/internal/gitaly/service/operations/apply_patch_test.go b/internal/gitaly/service/operations/apply_patch_test.go
index c7e5ffb15..9cfffa603 100644
--- a/internal/gitaly/service/operations/apply_patch_test.go
+++ b/internal/gitaly/service/operations/apply_patch_test.go
@@ -373,14 +373,30 @@ To restore the original branch and stop patching, run "git am --abort".
},
}))
+ outerLoop:
for _, patch := range patches {
// we stream the patches one rune at a time to exercise the streaming code
for _, r := range patch {
- require.NoError(t, stream.Send(&gitalypb.UserApplyPatchRequest{
+ err := stream.Send(&gitalypb.UserApplyPatchRequest{
UserApplyPatchRequestPayload: &gitalypb.UserApplyPatchRequest_Patches{
Patches: []byte{r},
},
- }))
+ })
+
+ // In case the request we're sending to the server results
+ // in an error it can happen that the server already noticed
+ // the request and thus returned an error while we're still
+ // streaming the actual patch data. If so, the server closes
+ // the stream and we are left unable to continue sending,
+ // which means we get an EOF here.
+ //
+ // Abort the loop here so that we can observe the actual
+ // error in `CloseAndRecv()`.
+ if err == io.EOF {
+ break outerLoop
+ }
+
+ require.NoError(t, err)
}
}