diff options
author | Paul Okstad <pokstad@gitlab.com> | 2020-01-23 19:16:14 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2020-01-23 19:16:14 +0300 |
commit | a3555da5c718c471fc640970676f02329ad1f565 (patch) | |
tree | 40dc4ee903000b028457cc85b4eefd15650e2053 /internal/git/safecmd_test.go | |
parent | 6b023d8bd90402c1c887b8f1c71f3c9e99542cac (diff) |
Disable git command in unit test TestSafeCmdValid
Diffstat (limited to 'internal/git/safecmd_test.go')
-rw-r--r-- | internal/git/safecmd_test.go | 10 |
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 } +} |