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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-12-13 16:46:38 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-12-30 16:18:23 +0300
commit92147a9af10c9b22385d952d3d9b6582609428c7 (patch)
treeebab9b969e893f57261e7e7efbc294f36cc017b6
parent40f74aac5f0aa92f3841483321ecb3c5e0f70cfb (diff)
git: Simplify test to compute Ruby sidecar Git configuration
In the past we used to make the `core.fsync` setting conditional on the Git version as it had only been introduced in Git v2.36.0. This can still be seen by one of our tests for retrieving the Ruby sidecar Git configuration, which still goes through some hoops to support this. Simplify the test to not use an intercepting Git command factory as we don't need to replace the version anymore and make the list of expected Git configuration static.
-rw-r--r--internal/git/command_factory_test.go39
1 files changed, 6 insertions, 33 deletions
diff --git a/internal/git/command_factory_test.go b/internal/git/command_factory_test.go
index 3356fe467..006f59968 100644
--- a/internal/git/command_factory_test.go
+++ b/internal/git/command_factory_test.go
@@ -593,44 +593,17 @@ func TestExecCommandFactory_SidecarGitConfiguration(t *testing.T) {
{Key: "custom.key", Value: "injected"},
}
- commonHead := []git.ConfigPair{
+ configPairs, err := gittest.NewCommandFactory(t, cfg).SidecarGitConfiguration(ctx)
+ require.NoError(t, err)
+ require.Equal(t, []git.ConfigPair{
{Key: "gc.auto", Value: "0"},
{Key: "core.autocrlf", Value: "input"},
{Key: "core.useReplaceRefs", Value: "false"},
{Key: "commitGraph.generationVersion", Value: "1"},
- }
-
- commonTail := []git.ConfigPair{
+ {Key: "core.fsync", Value: "objects,derived-metadata,reference"},
+ {Key: "core.fsyncMethod", Value: "fsync"},
{Key: "custom.key", Value: "injected"},
- }
-
- for _, tc := range []struct {
- desc string
- version string
- expectedConfig []git.ConfigPair
- }{
- {
- desc: "with core.fsync",
- version: "2.36.0",
- expectedConfig: append(append(commonHead,
- git.ConfigPair{Key: "core.fsync", Value: "objects,derived-metadata,reference"},
- git.ConfigPair{Key: "core.fsyncMethod", Value: "fsync"},
- ), commonTail...),
- },
- } {
- t.Run(tc.desc, func(t *testing.T) {
- factory := gittest.NewInterceptingCommandFactory(t, ctx, cfg, func(git.ExecutionEnvironment) string {
- return fmt.Sprintf(
- `#!/usr/bin/env bash
- echo "git version %s"
- `, tc.version)
- }, gittest.WithInterceptedVersion())
-
- configPairs, err := factory.SidecarGitConfiguration(ctx)
- require.NoError(t, err)
- require.Equal(t, tc.expectedConfig, configPairs)
- })
- }
+ }, configPairs)
}
// TestFsckConfiguration tests the hardcoded configuration of the