diff options
author | Igor <idrozdov@gitlab.com> | 2019-06-05 15:53:33 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-06-05 15:53:33 +0000 |
commit | 60e258e32b5df579136ba3cf10f7f07eb8206415 (patch) | |
tree | a425982099197962547ce903899d2456434736a6 /go/internal/command/uploadarchive/gitalycall_test.go | |
parent | f61185b8a8f8974225a701137ba4b75cf5d4c4ef (diff) | |
download | gitlab-shell-60e258e32b5df579136ba3cf10f7f07eb8206415.tar.gz |
Go implementation for git-upload-archive
Diffstat (limited to 'go/internal/command/uploadarchive/gitalycall_test.go')
-rw-r--r-- | go/internal/command/uploadarchive/gitalycall_test.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/go/internal/command/uploadarchive/gitalycall_test.go b/go/internal/command/uploadarchive/gitalycall_test.go new file mode 100644 index 0000000..78953a7 --- /dev/null +++ b/go/internal/command/uploadarchive/gitalycall_test.go @@ -0,0 +1,40 @@ +package uploadarchive + +import ( + "bytes" + "testing" + + "github.com/stretchr/testify/require" + + "gitlab.com/gitlab-org/gitlab-shell/go/internal/command/commandargs" + "gitlab.com/gitlab-org/gitlab-shell/go/internal/command/readwriter" + "gitlab.com/gitlab-org/gitlab-shell/go/internal/config" + "gitlab.com/gitlab-org/gitlab-shell/go/internal/gitlabnet/testserver" + "gitlab.com/gitlab-org/gitlab-shell/go/internal/testhelper/requesthandlers" +) + +func TestUploadPack(t *testing.T) { + gitalyAddress, cleanup := testserver.StartGitalyServer(t) + defer cleanup() + + requests := requesthandlers.BuildAllowedWithGitalyHandlers(t, gitalyAddress) + url, cleanup := testserver.StartHttpServer(t, requests) + defer cleanup() + + output := &bytes.Buffer{} + input := &bytes.Buffer{} + + userId := "1" + repo := "group/repo" + + cmd := &Command{ + Config: &config.Config{GitlabUrl: url}, + Args: &commandargs.CommandArgs{GitlabKeyId: userId, CommandType: commandargs.UploadArchive, SshArgs: []string{"git-upload-archive", repo}}, + ReadWriter: &readwriter.ReadWriter{ErrOut: output, Out: output, In: input}, + } + + err := cmd.Execute() + require.NoError(t, err) + + require.Equal(t, "UploadArchive: "+repo, output.String()) +} |