summaryrefslogtreecommitdiff
path: root/go/internal/command/command_test.go
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2019-05-31 12:08:54 +0000
committerNick Thomas <nick@gitlab.com>2019-05-31 12:08:54 +0000
commit4342831aa40c64e0af3624b934ba0610c22345ba (patch)
tree688dc50182c8429941d4d23edad3aedc08471233 /go/internal/command/command_test.go
parent12ca54c2d998803a0564a5a2942121364a30678f (diff)
parent033c81d546d31d07e5eadb50611543a7d2471254 (diff)
downloadgitlab-shell-4342831aa40c64e0af3624b934ba0610c22345ba.tar.gz
Merge branch 'id-git-receive-pack' into 'master'
Go implementation for git-receive-pack Closes #161 See merge request gitlab-org/gitlab-shell!300
Diffstat (limited to 'go/internal/command/command_test.go')
-rw-r--r--go/internal/command/command_test.go23
1 files changed, 19 insertions, 4 deletions
diff --git a/go/internal/command/command_test.go b/go/internal/command/command_test.go
index 228dc7a..99069c7 100644
--- a/go/internal/command/command_test.go
+++ b/go/internal/command/command_test.go
@@ -3,9 +3,11 @@ package command
import (
"testing"
- "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+
"gitlab.com/gitlab-org/gitlab-shell/go/internal/command/discover"
"gitlab.com/gitlab-org/gitlab-shell/go/internal/command/fallback"
+ "gitlab.com/gitlab-org/gitlab-shell/go/internal/command/receivepack"
"gitlab.com/gitlab-org/gitlab-shell/go/internal/command/twofactorrecover"
"gitlab.com/gitlab-org/gitlab-shell/go/internal/config"
"gitlab.com/gitlab-org/gitlab-shell/go/internal/testhelper"
@@ -58,6 +60,19 @@ func TestNew(t *testing.T) {
},
expectedType: &twofactorrecover.Command{},
},
+ {
+ desc: "it returns a ReceivePack command if the feature is enabled",
+ arguments: []string{},
+ config: &config.Config{
+ GitlabUrl: "http+unix://gitlab.socket",
+ Migration: config.MigrationConfig{Enabled: true, Features: []string{"git-receive-pack"}},
+ },
+ environment: map[string]string{
+ "SSH_CONNECTION": "1",
+ "SSH_ORIGINAL_COMMAND": "git-receive-pack",
+ },
+ expectedType: &receivepack.Command{},
+ },
}
for _, tc := range testCases {
@@ -67,8 +82,8 @@ func TestNew(t *testing.T) {
command, err := New(tc.arguments, tc.config, nil)
- assert.NoError(t, err)
- assert.IsType(t, tc.expectedType, command)
+ require.NoError(t, err)
+ require.IsType(t, tc.expectedType, command)
})
}
}
@@ -80,6 +95,6 @@ func TestFailingNew(t *testing.T) {
_, err := New([]string{}, &config.Config{}, nil)
- assert.Error(t, err, "Only ssh allowed")
+ require.Error(t, err, "Only ssh allowed")
})
}