summaryrefslogtreecommitdiff
path: root/go/internal/command/command_test.go
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2019-10-03 18:11:56 +0100
committerNick Thomas <nick@gitlab.com>2019-10-08 13:13:59 +0100
commitba9b7c0e8acd7b3acb03086a5c1e132256fbd36e (patch)
treec51ad0a6abc344cdb51b3681bd429b612f553ed0 /go/internal/command/command_test.go
parent542b26139243c8fbed2af669d081f10c4ebbae40 (diff)
downloadgitlab-shell-ba9b7c0e8acd7b3acb03086a5c1e132256fbd36e.tar.gz
Rewrite bin/check in Go
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"},