summaryrefslogtreecommitdiff
path: root/internal/command
diff options
context:
space:
mode:
authorAsh McKenzie <amckenzie@gitlab.com>2020-10-19 14:41:45 +1100
committerAsh McKenzie <amckenzie@gitlab.com>2020-10-19 18:53:11 +1100
commitf5f9ffc086fe52e2651fb498a76673bda3392bfd (patch)
treebe21e3cb040376c6f99f1e2ff6416d9702b1c50c /internal/command
parent12353c0c1d6ddf57b738b04d86cdd34ce64f2f18 (diff)
downloadgitlab-shell-f5f9ffc086fe52e2651fb498a76673bda3392bfd.tar.gz
Remove prefixing with SSL_CERT_DIR
Diffstat (limited to 'internal/command')
-rw-r--r--internal/command/authorizedkeys/authorized_keys_test.go15
-rw-r--r--internal/command/authorizedprincipals/authorized_principals_test.go15
2 files changed, 2 insertions, 28 deletions
diff --git a/internal/command/authorizedkeys/authorized_keys_test.go b/internal/command/authorizedkeys/authorized_keys_test.go
index f15c34d..ab44580 100644
--- a/internal/command/authorizedkeys/authorized_keys_test.go
+++ b/internal/command/authorizedkeys/authorized_keys_test.go
@@ -47,11 +47,9 @@ func TestExecute(t *testing.T) {
defer cleanup()
defaultConfig := &config.Config{RootDir: "/tmp", GitlabUrl: url}
- configWithSslCertDir := &config.Config{RootDir: "/tmp", GitlabUrl: url, SslCertDir: "/tmp/certs"}
testCases := []struct {
desc string
- config *config.Config
arguments *commandargs.AuthorizedKeys
expectedOutput string
}{
@@ -61,12 +59,6 @@ func TestExecute(t *testing.T) {
expectedOutput: "command=\"/tmp/bin/gitlab-shell key-1\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty public-key\n",
},
{
- desc: "With SSL cert dir",
- config: configWithSslCertDir,
- arguments: &commandargs.AuthorizedKeys{ExpectedUser: "user", ActualUser: "user", Key: "key"},
- expectedOutput: "command=\"SSL_CERT_DIR=/tmp/certs /tmp/bin/gitlab-shell key-1\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty public-key\n",
- },
- {
desc: "When key doesn't match any existing key",
arguments: &commandargs.AuthorizedKeys{ExpectedUser: "user", ActualUser: "user", Key: "not-found"},
expectedOutput: "# No key was found for not-found\n",
@@ -87,13 +79,8 @@ func TestExecute(t *testing.T) {
t.Run(tc.desc, func(t *testing.T) {
buffer := &bytes.Buffer{}
- config := defaultConfig
- if tc.config != nil {
- config = tc.config
- }
-
cmd := &Command{
- Config: config,
+ Config: defaultConfig,
Args: tc.arguments,
ReadWriter: &readwriter.ReadWriter{Out: buffer},
}
diff --git a/internal/command/authorizedprincipals/authorized_principals_test.go b/internal/command/authorizedprincipals/authorized_principals_test.go
index ec97b65..2450a54 100644
--- a/internal/command/authorizedprincipals/authorized_principals_test.go
+++ b/internal/command/authorizedprincipals/authorized_principals_test.go
@@ -14,11 +14,9 @@ import (
func TestExecute(t *testing.T) {
defaultConfig := &config.Config{RootDir: "/tmp"}
- configWithSslCertDir := &config.Config{RootDir: "/tmp", SslCertDir: "/tmp/certs"}
testCases := []struct {
desc string
- config *config.Config
arguments *commandargs.AuthorizedPrincipals
expectedOutput string
}{
@@ -28,12 +26,6 @@ func TestExecute(t *testing.T) {
expectedOutput: "command=\"/tmp/bin/gitlab-shell username-key\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty principal\n",
},
{
- desc: "With SSL cert dir",
- config: configWithSslCertDir,
- arguments: &commandargs.AuthorizedPrincipals{KeyId: "key", Principals: []string{"principal"}},
- expectedOutput: "command=\"SSL_CERT_DIR=/tmp/certs /tmp/bin/gitlab-shell username-key\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty principal\n",
- },
- {
desc: "With multiple principals",
arguments: &commandargs.AuthorizedPrincipals{KeyId: "key", Principals: []string{"principal-1", "principal-2"}},
expectedOutput: "command=\"/tmp/bin/gitlab-shell username-key\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty principal-1\ncommand=\"/tmp/bin/gitlab-shell username-key\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty principal-2\n",
@@ -44,13 +36,8 @@ func TestExecute(t *testing.T) {
t.Run(tc.desc, func(t *testing.T) {
buffer := &bytes.Buffer{}
- config := defaultConfig
- if tc.config != nil {
- config = tc.config
- }
-
cmd := &Command{
- Config: config,
+ Config: defaultConfig,
Args: tc.arguments,
ReadWriter: &readwriter.ReadWriter{Out: buffer},
}