summaryrefslogtreecommitdiff
path: root/internal/command/receivepack
diff options
context:
space:
mode:
authorDavid Kim <dkim@gitlab.com>2020-03-30 19:06:23 +1030
committerDavid Kim <dkim@gitlab.com>2020-03-30 19:06:23 +1030
commit3f3a405c181840e2de13ffb22f7a50fd78054dc0 (patch)
tree29fce1b63df3ffa4ca242fc6152666a0b92a7882 /internal/command/receivepack
parent90fe3a0bd925be0272d92f3ac6f555dd5837cf9e (diff)
downloadgitlab-shell-3f3a405c181840e2de13ffb22f7a50fd78054dc0.tar.gz
Add tests for logging
Diffstat (limited to 'internal/command/receivepack')
-rw-r--r--internal/command/receivepack/gitalycall_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/command/receivepack/gitalycall_test.go b/internal/command/receivepack/gitalycall_test.go
index de20bfd..a20e858 100644
--- a/internal/command/receivepack/gitalycall_test.go
+++ b/internal/command/receivepack/gitalycall_test.go
@@ -3,6 +3,9 @@ package receivepack
import (
"bytes"
"testing"
+ "strings"
+
+ "github.com/sirupsen/logrus"
"github.com/stretchr/testify/require"
@@ -11,6 +14,7 @@ import (
"gitlab.com/gitlab-org/gitlab-shell/internal/config"
"gitlab.com/gitlab-org/gitlab-shell/internal/gitlabnet/testserver"
"gitlab.com/gitlab-org/gitlab-shell/internal/testhelper/requesthandlers"
+ "gitlab.com/gitlab-org/gitlab-shell/internal/testhelper"
)
func TestReceivePack(t *testing.T) {
@@ -33,8 +37,12 @@ func TestReceivePack(t *testing.T) {
ReadWriter: &readwriter.ReadWriter{ErrOut: output, Out: output, In: input},
}
+ hook := testhelper.SetupLogger()
+
err := cmd.Execute()
require.NoError(t, err)
require.Equal(t, "ReceivePack: "+userId+" "+repo, output.String())
+ require.Equal(t, logrus.InfoLevel, hook.LastEntry().Level)
+ require.True(t, strings.Contains(hook.LastEntry().Message, "executing git command"))
}