summaryrefslogtreecommitdiff
path: root/go/internal/command/command_test.go
diff options
context:
space:
mode:
authorAsh McKenzie <amckenzie@gitlab.com>2019-10-09 02:55:52 +0000
committerAsh McKenzie <amckenzie@gitlab.com>2019-10-09 02:55:52 +0000
commit26ad6f92dc6d74b2f35b8a96705caf27054f5440 (patch)
treebe11f701523c8cf60f5b0622f148ba358c3c9081 /go/internal/command/command_test.go
parente28f75c8d439812f61c4cf0c0291380df4d17106 (diff)
parentba9b7c0e8acd7b3acb03086a5c1e132256fbd36e (diff)
downloadgitlab-shell-26ad6f92dc6d74b2f35b8a96705caf27054f5440.tar.gz
Merge branch '173-remove-bin-check' into 'master'
Rewrite `bin/check` in Go See merge request gitlab-org/gitlab-shell!341
Diffstat (limited to 'go/internal/command/command_test.go')
-rw-r--r--go/internal/command/command_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/go/internal/command/command_test.go b/go/internal/command/command_test.go
index 59f22e2..8f14db3 100644
--- a/go/internal/command/command_test.go
+++ b/go/internal/command/command_test.go
@@ -9,6 +9,7 @@ import (
"gitlab.com/gitlab-org/gitlab-shell/go/internal/command/authorizedkeys"
"gitlab.com/gitlab-org/gitlab-shell/go/internal/command/authorizedprincipals"
"gitlab.com/gitlab-org/gitlab-shell/go/internal/command/discover"
+ "gitlab.com/gitlab-org/gitlab-shell/go/internal/command/healthcheck"
"gitlab.com/gitlab-org/gitlab-shell/go/internal/command/lfsauthenticate"
"gitlab.com/gitlab-org/gitlab-shell/go/internal/command/receivepack"
"gitlab.com/gitlab-org/gitlab-shell/go/internal/command/shared/disallowedcommand"
@@ -23,6 +24,7 @@ import (
var (
authorizedKeysExec = &executable.Executable{Name: executable.AuthorizedKeysCheck}
authorizedPrincipalsExec = &executable.Executable{Name: executable.AuthorizedPrincipalsCheck}
+ checkExec = &executable.Executable{Name: executable.Healthcheck}
gitlabShellExec = &executable.Executable{Name: executable.GitlabShell}
basicConfig = &config.Config{GitlabUrl: "http+unix://gitlab.socket"}
@@ -35,6 +37,13 @@ func buildEnv(command string) map[string]string {
}
}
+func buildCheckAllowedEnv(command string) map[string]string {
+ out := buildEnv(command)
+ out["GITLAB_SHELL_ALLOW_CHECK_COMMAND"] = "1"
+
+ return out
+}
+
func TestNew(t *testing.T) {
testCases := []struct {
desc string
@@ -80,6 +89,11 @@ func TestNew(t *testing.T) {
expectedType: &uploadarchive.Command{},
},
{
+ desc: "it returns a Healthcheck command",
+ executable: checkExec,
+ expectedType: &healthcheck.Command{},
+ },
+ {
desc: "it returns a AuthorizedKeys command",
executable: authorizedKeysExec,
arguments: []string{"git", "git", "key"},