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:
authorJohn Cai <jcai@gitlab.com>2020-01-23 19:16:14 +0300
committerJohn Cai <jcai@gitlab.com>2020-01-23 19:16:14 +0300
commita74fe57e74782d0bb306ba3d36a41ee25d43d324 (patch)
tree40dc4ee903000b028457cc85b4eefd15650e2053
parent6b023d8bd90402c1c887b8f1c71f3c9e99542cac (diff)
parenta3555da5c718c471fc640970676f02329ad1f565 (diff)
Merge branch 'po-safecmd-disable-git' into 'master'
Disable git command in unit test TestSafeCmdValid See merge request gitlab-org/gitaly!1777
-rw-r--r--internal/git/safecmd_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/git/safecmd_test.go b/internal/git/safecmd_test.go
index 29a796ca0..8d9a508ef 100644
--- a/internal/git/safecmd_test.go
+++ b/internal/git/safecmd_test.go
@@ -5,6 +5,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/config"
"gitlab.com/gitlab-org/gitaly/internal/git"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -121,6 +122,9 @@ func TestSafeCmdValid(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
+ reenableGitCmd := disableGitCmd()
+ defer reenableGitCmd()
+
for _, tt := range []struct {
globals []git.Option
subCmd git.SubCmd
@@ -208,3 +212,9 @@ func TestSafeCmdValid(t *testing.T) {
require.Equal(t, tt.expectArgs, cmd.Args()[1:])
}
}
+
+func disableGitCmd() testhelper.Cleanup {
+ oldBinPath := config.Config.Git.BinPath
+ config.Config.Git.BinPath = "/bin/echo"
+ return func() { config.Config.Git.BinPath = oldBinPath }
+}