Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Cai <jcai@gitlab.com>2019-01-23 21:05:05 +0300
committerJohn Cai <jcai@gitlab.com>2019-01-23 21:05:05 +0300
commitc2597e5b0a8246b97556127551f3c7af14865dff (patch)
treee46d5bf8ffdf0378c9399c3b7b2630f3b01e8e13
parent9bbd87b1e13b8f37fc24db6644a0c146e4711a45 (diff)
parenta59c5d19745c207addcf59d1d6956eca1937648f (diff)
Merge branch 'fix-unix-socket-tests' into 'master'
Fix tests that used long unix socket paths Closes #1460 See merge request gitlab-org/gitaly!1039
-rw-r--r--changelogs/unreleased/fix-unix-socket-tests.yml5
-rw-r--r--client/dial_test.go10
-rw-r--r--cmd/gitaly-ssh/auth_test.go7
3 files changed, 13 insertions, 9 deletions
diff --git a/changelogs/unreleased/fix-unix-socket-tests.yml b/changelogs/unreleased/fix-unix-socket-tests.yml
new file mode 100644
index 000000000..e9cc4312c
--- /dev/null
+++ b/changelogs/unreleased/fix-unix-socket-tests.yml
@@ -0,0 +1,5 @@
+---
+title: Fix tests that used long unix socket paths
+merge_request: 1039
+author:
+type: fixed
diff --git a/client/dial_test.go b/client/dial_test.go
index a7edd5598..9c3e392a8 100644
--- a/client/dial_test.go
+++ b/client/dial_test.go
@@ -6,7 +6,6 @@ import (
"fmt"
"net"
"os"
- "path/filepath"
"strings"
"testing"
@@ -41,12 +40,11 @@ func TestDial(t *testing.T) {
require.NoError(t, err, "start listeners: %v. %s", err)
defer stop()
- wd, err := os.Getwd()
- require.NoError(t, err, "getwd: %v. %s", err)
-
unixSocketAbsPath := connectionMap["unix"]
- unixSocketRelPath, err := filepath.Rel(wd, unixSocketAbsPath)
- require.NoError(t, err, "relative path failure: %v. %s", err)
+
+ unixSocketRelPath := "testdata/gitaly.socket"
+ require.NoError(t, os.RemoveAll(unixSocketRelPath))
+ require.NoError(t, os.Symlink(unixSocketAbsPath, unixSocketRelPath))
tests := []struct {
name string
diff --git a/cmd/gitaly-ssh/auth_test.go b/cmd/gitaly-ssh/auth_test.go
index 33f76ef21..a425861f2 100644
--- a/cmd/gitaly-ssh/auth_test.go
+++ b/cmd/gitaly-ssh/auth_test.go
@@ -6,7 +6,6 @@ import (
"os"
"os/exec"
"path"
- "path/filepath"
"strconv"
"strings"
"testing"
@@ -45,8 +44,9 @@ func TestConnectivity(t *testing.T) {
socketPath := testhelper.GetTemporaryGitalySocketFileName()
- relativeSocketPath, err := filepath.Rel(cwd, socketPath)
- require.NoError(t, err, "relative path failure: %v. %s", err)
+ relativeSocketPath := "testdata/gitaly.socket"
+ require.NoError(t, os.RemoveAll(relativeSocketPath))
+ require.NoError(t, os.Symlink(socketPath, relativeSocketPath))
tcpServer, tcpPort := runServer(t, server.NewInsecure, "tcp", "localhost:0")
defer tcpServer.Stop()
@@ -104,6 +104,7 @@ func TestConnectivity(t *testing.T) {
cmd.Env = []string{
fmt.Sprintf("GITALY_PAYLOAD=%s", payload),
fmt.Sprintf("GITALY_ADDRESS=%s", testcase.addr),
+ fmt.Sprintf("GITALY_WD=%s", cwd),
fmt.Sprintf("PATH=.:%s", os.Getenv("PATH")),
fmt.Sprintf("GIT_SSH_COMMAND=%s upload-pack", gitalySSHPath),
fmt.Sprintf("SSL_CERT_DIR=%s", certPoolPath),