diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2019-01-10 19:12:33 +0300 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2019-01-10 19:33:53 +0300 |
commit | 870ade19688ea6a0c6fe60feb3f5fdd33c492017 (patch) | |
tree | a32a8ee768e49fe7ab0bd1be056cd0d36271575b | |
parent | e8025b70287209a837d4e638c8c894360c68b3ce (diff) |
Add test cases for MR 1032, drop unix:// supportjv-add-testcases-mr-1032
-rw-r--r-- | client/address_parser_test.go | 8 | ||||
-rw-r--r-- | cmd/gitaly-ssh/auth_test.go | 13 |
2 files changed, 15 insertions, 6 deletions
diff --git a/client/address_parser_test.go b/client/address_parser_test.go index 820a902b3..78368e5d3 100644 --- a/client/address_parser_test.go +++ b/client/address_parser_test.go @@ -10,10 +10,10 @@ func TestParseAddress(t *testing.T) { canonical string invalid bool }{ - {raw: "unix:/foo/bar.socket", canonical: "unix:///foo/bar.socket"}, - {raw: "unix:///foo/bar.socket", canonical: "unix:///foo/bar.socket"}, - // Mainly for test purposes we explicitly want to support relative paths - {raw: "unix://foo/bar.socket", canonical: "unix://foo/bar.socket"}, + {raw: "unix:/foo/bar.socket", canonical: "unix:/foo/bar.socket"}, + {raw: "unix://foo/bar.socket", canonical: "unix:/foo/bar.socket"}, + {raw: "unix:///foo/bar.socket", canonical: "unix:/foo/bar.socket"}, + // We explicitly want to support relative paths {raw: "unix:foo/bar.socket", canonical: "unix:foo/bar.socket"}, {raw: "tcp://1.2.3.4", canonical: "1.2.3.4"}, {raw: "tcp://1.2.3.4:567", canonical: "1.2.3.4:567"}, diff --git a/cmd/gitaly-ssh/auth_test.go b/cmd/gitaly-ssh/auth_test.go index 070f2f453..5845598c3 100644 --- a/cmd/gitaly-ssh/auth_test.go +++ b/cmd/gitaly-ssh/auth_test.go @@ -6,6 +6,7 @@ import ( "os" "os/exec" "path" + "path/filepath" "strconv" "strings" "testing" @@ -44,6 +45,9 @@ func TestConnectivity(t *testing.T) { socketPath := testhelper.GetTemporaryGitalySocketFileName() + relSocketPath, err := filepath.Rel("/", socketPath) + require.NoError(t, err) + tcpServer, tcpPort := runServer(t, server.NewInsecure, "tcp", "localhost:0") defer tcpServer.Stop() @@ -63,8 +67,12 @@ func TestConnectivity(t *testing.T) { addr: fmt.Sprintf("tcp://localhost:%d", tcpPort), }, { - name: "unix", - addr: fmt.Sprintf("unix://%s", socketPath), + name: "unix: absolute", + addr: "unix:" + socketPath, + }, + { + name: "unix: relative", + addr: "unix:" + relSocketPath, }, { name: "unix_with_proxy", @@ -87,6 +95,7 @@ func TestConnectivity(t *testing.T) { t.Run(testcase.name, func(t *testing.T) { cmd := exec.Command("git", "ls-remote", "git@localhost:test/test.git", "refs/heads/master") cmd.Stderr = os.Stderr + cmd.Dir = "/" cmd.Env = []string{ fmt.Sprintf("GITALY_PAYLOAD=%s", payload), fmt.Sprintf("GITALY_ADDRESS=%s", testcase.addr), |