From f5f9ffc086fe52e2651fb498a76673bda3392bfd Mon Sep 17 00:00:00 2001 From: Ash McKenzie Date: Mon, 19 Oct 2020 14:41:45 +1100 Subject: Remove prefixing with SSL_CERT_DIR --- internal/command/authorizedkeys/authorized_keys_test.go | 15 +-------------- .../authorizedprincipals/authorized_principals_test.go | 15 +-------------- 2 files changed, 2 insertions(+), 28 deletions(-) (limited to 'internal/command') 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 }{ @@ -60,12 +58,6 @@ func TestExecute(t *testing.T) { arguments: &commandargs.AuthorizedKeys{ExpectedUser: "user", ActualUser: "user", Key: "key"}, 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"}, @@ -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 }{ @@ -27,12 +25,6 @@ func TestExecute(t *testing.T) { arguments: &commandargs.AuthorizedPrincipals{KeyId: "key", Principals: []string{"principal"}}, 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"}}, @@ -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}, } -- cgit v1.2.1