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
AgeCommit message (Collapse)Author
2022-06-17smarthttp: Fix keep-alive packets breaking tests on slow machinespks-smarthttp-test-refactoringsPatrick Steinhardt
On some machines we see that the PostUploadPack tests are flaky because the responses we receive sometimes contain `0005\01` prefixes. As it turns out, these are keep-alive packets that Git starts to send over the sideband every 5 seconds after it has received the full packfile from the client. So these are legit and can totally be expected on machines that are sufficiently slow. Implement a new helper function `requireSideband()` that parses the response into separate sideband lines while stripping out any keep-alive packets to fix this flakiness.
2022-06-17smarthttp: Move test helper functions to the bottomPatrick Steinhardt
Group together test helper functions at the bottom of our PostReceivePack tests to make them easier to find.
2022-06-17smarthttp: Adjust test names for PostReceivePack testsPatrick Steinhardt
Adjust test names for PostReceivePack tests to match our best practices.
2022-06-17smarthttp: Some random improvements to PostReceivePack testsPatrick Steinhardt
This is a set of random small refactors for the PostReceivePack tests to align them better with our current best practices with regards to tests.
2022-06-17smarthttp: Assert actual errors in validation tests for PostReceivePackPatrick Steinhardt
The tests which exercise our request validation for PostReceivePack only assert error codes. This is quite fragile though as it could easily be that the error code matches what we'd expect, while the actual error is still caused by something different. Refactor the test to instead verify that the actual error matches.
2022-06-17smarthttp: Rename `doPush()` to `performPush()`Patrick Steinhardt
Rename `doPush()` to `performPush()` to clarify the intent of this helper function. While at it, change its return type from `[]byte` to `string`: all callers cast the result to a string anyway.
2022-06-17smarthttp: Refactor helper to create requests for PostReceivePackPatrick Steinhardt
The `newTestPush()` helper is not really matching our current best practices with regards to how we write tests. It's hard to understand what this function does by just taking a look at its name. Refactor the code to better match our best practices and rename the helper to `createPushRequest()`.
2022-06-17smarthttp: Use gittest helpers to write pktlinesPatrick Steinhardt
Convert tests to use gittest helpers to write pktlines instead of using our own, hand-coded implementation.
2022-06-17ssh: Avoid using worktrees in testsPatrick Steinhardt
We're currently creating a worktree in some of smarthttp's tests in order to be able to write commits. Convert `newTestPush()` to instead use `gittest.WriteCommit()`, which doesn't require a worktree.
2022-06-17gittest: Fix `ExecOpts()` with explicit stdout writerPatrick Steinhardt
The `ExecOpts()` function accepts a configuration that allows the caller to set various options like the standard streams. As it turns out though setting `Stdout` in that configuration is broken and will cause us to fail immediately. The root cause is that we call `exec.Cmd.Output()`, which is not allowed when you set the command's `Stdout` variable. Fix this by calling `Run()` instead when `Stdout` is passed by the caller. Add tests to catch any future regressions.
2022-06-17gittest: Add function to write formatted pktlinesPatrick Steinhardt
Add function to write formatted pktlines to a writer.
2022-06-17Merge branch 'renovate/golang.org-x-sys-digest' into 'master'Patrick Steinhardt
go: Update golang.org/x/sys digest to 4f61da8 See merge request gitlab-org/gitaly!4636
2022-06-17Merge branch 'renovate/github.com-google-go-cmp-0.x' into 'master'Patrick Steinhardt
go: Update module github.com/google/go-cmp to v0.5.8 See merge request gitlab-org/gitaly!4639
2022-06-17Merge branch 'renovate/go.uber.org-goleak-1.x' into 'master'Patrick Steinhardt
go: Update module go.uber.org/goleak to v1.1.12 See merge request gitlab-org/gitaly!4641
2022-06-17Merge branch 'renovate/github.com-stretchr-testify-1.x' into 'master'Patrick Steinhardt
go: Update module github.com/stretchr/testify to v1.7.2 See merge request gitlab-org/gitaly!4640
2022-06-16Merge branch 'jc-propagate-ff-to-git2go' into 'master'John Cai
git2go: Pass feature flags into gitaly-git2go binary See merge request gitlab-org/gitaly!4601
2022-06-16Merge branch 'jc-remove-max-queue-size-ff' into 'master'Will Chandler
featureflag: Remove concurrency_queue_enforce_max feature flag See merge request gitlab-org/gitaly!4620
2022-06-16git2go: Pass feature flags into gitaly-git2go binaryJohn Cai
Currently when we call gitaly-git2go, we lose feature flags since they are in the context inside the request that comes from Rails. In order to allow gitaly-git2go to benefit from feature flags, we can pass it in through an environment variable much like we do for gitaly-hooks. In order to test this, add a new subcommand for gitaly-git2go that simply returns which feature flags are set in the context. Since we only gets built for tests, build this in only with the `test` build tag. Changelog: changed
2022-06-16go: Update module go.uber.org/goleak to v1.1.12GitLab Renovate Bot
2022-06-16go: Update module github.com/stretchr/testify to v1.7.2GitLab Renovate Bot
2022-06-16go: Update module github.com/google/go-cmp to v0.5.8GitLab Renovate Bot
2022-06-16Update changelog for 15.0.3GitLab Release Tools Bot
[ci skip]
2022-06-16Merge branch 'pks-ssh-upload-pack-test-refactorings' into 'master'Patrick Steinhardt
ssh: Refactor SSHUploadPack tests to match modern best practices See merge request gitlab-org/gitaly!4614
2022-06-16go: Update golang.org/x/sys digest to 4f61da8GitLab Renovate Bot
2022-06-15Merge branch 'find-changed-paths-commit-pairs' into 'master'Will Chandler
FindChangedPaths: Add requests field See merge request gitlab-org/gitaly!4597
2022-06-15Merge branch 'jc-pass-user-details-to-pack-objects' into 'master'John Cai
Add glId, glUser, glRepo, glProtocol to PackObjectsRequest See merge request gitlab-org/gitaly!4599
2022-06-15gitaly-hooks: Pass in user details to call to PackObjectsHookjc-pass-user-details-to-pack-objectsJohn Cai
Now that we have access to the user_id, username, and protocol, we can pass these values into the request to PackObjectsHookWithSidechannel
2022-06-15git: Add protocol, user_id, username to WithPackObjectsHookEnvJohn Cai
Add user_id, username, protocol to the payload we send to the hook so that it can call the PackObjectsHookWithSidechannel with these values.
2022-06-15git: Change ReceiveHooksPayload to UserDetailsJohn Cai
The ReceiveHooksPayload contains information like the UserID, Username, Protocol that would also be useful for UploadPack. Rename this to UserDetails to be more generic, so that we can share this in both places. However, in order to keep upgrades compatible, keep the ReceiveHooksPayload and the receive_hooks_payload json tag. During an upgrade, the gitaly-hooks binary will be replaced before the gitaly binary, so there will be a short period of time when an old gitaly will be sending to a newer gitaly-hooks. For this reason, we want to allow the newer gitaly-hooks to still recognize a receive_hooks_payload key.
2022-06-15Merge branch 'jc-praefect-subcmd-list-virtual-storages' into 'master'Toon Claes
praefect: Add list-storages subcommand Closes #3239 See merge request gitlab-org/gitaly!4609
2022-06-15Merge branch 'renovate/golang.org-x-sys-digest' into 'master'Patrick Steinhardt
go: Update golang.org/x/sys digest to 6c1b26c See merge request gitlab-org/gitaly!4628
2022-06-15go: Update golang.org/x/sys digest to 6c1b26cGitLab Renovate Bot
2022-06-15Merge branch 'renovate/golang.org-x-time-digest' into 'master'Patrick Steinhardt
go: Update golang.org/x/time digest to 579cf78 See merge request gitlab-org/gitaly!4629
2022-06-15go: Update golang.org/x/time digest to 579cf78GitLab Renovate Bot
2022-06-15Merge branch 'pks-danger-fix-duplicate-gemfile' into 'master'Toon Claes
ci: Fix Danger job being broken because of duplicate Gemfiles See merge request gitlab-org/gitaly!4633
2022-06-15Merge branch 'pks-user-merge-branch-structured-merge-conflict-error' into ↵Patrick Steinhardt
'master' operations: Return structured errors on conflict in UserMergeBranch Closes #4066 See merge request gitlab-org/gitaly!4623
2022-06-15ci: Fix Danger job being broken because of duplicate GemfilesPatrick Steinhardt
Recently our Danger job has started failing with the following error message: ``` [!] There was an error parsing `injected gems`: You cannot specify the same gem twice with different version requirements. You specified: gitlab-dangerfiles (~> 3.1.0) and gitlab-dangerfiles (>= 0). Gem already added. Bundler cannot continue. ``` As it turns out, this breakage is caused by the upstream change 9e3eff4 (Don't require projects to contain Gemfile when using danger-review job, 2022-06-10) in the common pipeline configurations: if the CI job detects that there is no Gemfile, it has now started to write one for us that contains the `gitlab-dangerfiles` version. And because our Gemfile is not contained in the root directory but instead in the `danger/` sub directory we now end up with two Gemfiles. Fix this issue by making use of the new feature: instead of carrying our own Gemfile, we can now simply rely on the auto-generated Gemfile. While this forces us to get rid of the Ruby cache which was keyed by our own Gemfile, this is really not an issue at all: execution of the whole job only takes about 40 seconds without the cache, which is fast enough.
2022-06-15operations: Return structured errors on conflict in UserMergeBranchPatrick Steinhardt
While we already handle some of the errors in UserMergeBranch specially via structured errors, we don't yet do so for merge conflicts. Amend this error handling so that callers can know that the error is indeed caused by a merge conflict, and so that they can find our exactly which files have been conflicting. Note that this is not done behind a feature flag: there aren't any callers which parse the error, and neither should there be any. So given that we retain the same error code as before but only amend the error message and add some error details this should not be a breaking change. Changelog: added
2022-06-15operations: Remove check for specific error messagePatrick Steinhardt
In UserMergeBranch we're verifying whether the error message returned by `gitaly-git2go` contains a specific string to be able to discern the case where the merge failed because of a merge conflict. This check is not required anymore though given that we now always get a specific `ConflictingFilesError{}` in that case. Remove the check to clean up the logic.
2022-06-15operations: Provide conflicting commits on merge conflict errorPatrick Steinhardt
The structured `MergeConflictError` provides information about the files that have been conflicting, but it doesn't provide any information about the revisions that caused the merge conflict. While that info should in the general case already be available on the calling-side, it may not necessarily be in case the caller e.g. only specified branch names instead of commit IDs. Add a new `ConflictingCommitIDs` field to the message that contains the object IDs of the conflicting commits to provide additional context.
2022-06-15Merge branch 'renovate/golang.org-x-sync-digest' into 'master'Patrick Steinhardt
chore(deps): update golang.org/x/sync digest to 0de741c See merge request gitlab-org/gitaly!4627
2022-06-15ssh: Adjust test names to match modern best practicespks-ssh-upload-pack-test-refactoringsPatrick Steinhardt
Adjust names of SSHUploadPack tests to match modern best practices.
2022-06-15ssh: Fix test setup not actually exercising clone failurePatrick Steinhardt
One of our tests that ought to verify whether cloning fails when we pass an invalid repository only checked that an error was returned, but it never checked what kind of error was returned. And sure enough, nowadays we don't fail because of an invalid request, but because the test setup is incomplete and missing the `gitaly-ssh` binary. Fix the test setup to build this binary and verify that the error matches what we expect so we don't regress again in the future.
2022-06-15ssh: Stop setting the PATH environment variable in testsPatrick Steinhardt
There is no reason for us to set the `PATH` environment variable explicitly in our tests, so let's stop doing that.
2022-06-15ssh: Merge hidden tag tests into successful testsPatrick Steinhardt
The tests which exercise whether we can pass Git configuration to SSHUploadPack with hidden tags as a proxy use the same setup as our other tests which verify that this RPC works alright. Merge both tests into a single one to reduce code duplication.
2022-06-15ssh: Merge protocol tests into successful testsPatrick Steinhardt
The tests we have which exercise whether we can indeed use Git protocol v2 as expected use the same setup as our other tests which exercise successful invocations of SSHUploadPack, with the only exception being that they don't use a protocol-detecting command factory. Let's merge these tests, which also increases our test coverage for the Git protocol to now also verify with sidechannels and the pack-objects cache as well as without protocol v2.
2022-06-15ssh: Merge partial clone filter tests into successful testsPatrick Steinhardt
The tests which exercise our partial clone filters for SSHUploadPack have the exact same setup as our tests which verify that we can do other successful requests, as well. Let's merge both tests into one to avoid some code duplication.
2022-06-15ssh: Moderinze test exercising failure of Git in SSHUploadPackPatrick Steinhardt
Our testcase that exercises SSHUploadPack in the context of Git failures is using quite dated code patterns. Modernize it to match our current best practices. While at it, refactor `testPostUploadPackFailedResponse()`: it's not at all obvious what this function does just by looking at its name, and the looping logic is a tad weird, too. This is both fixed by updating the code style and renaming it to `recvUntilError()`, which should hopefully be easier to understand.
2022-06-15ssh: Verify we get expected errors instead of only asserting error codesPatrick Steinhardt
The tests verifying that request validation works as expected for SSHUploadPack are currently only asserting the error code. This is fragile and may easily lead to failures that we assume to be what we expected, but which are actually caused by something different. Refactor the test to instead verify the full error to tighten it.
2022-06-15ssh: Use table-driven tests instead of multiple indirectionsPatrick Steinhardt
Because SSHUploadPack can either be invoked with or without sidechannel and with and without the pack-objects cache we need to re-run some tests multiple times with all combinations. This is solved via separate tests which call into the same function, but in a rather weird way where `TestFn()` calls `testFn()`, which then again calls `testFn2()`. This is mighty confusing. Refactor the test to instead be table-driven to simplify it.