diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2020-11-18 18:27:00 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2020-11-24 11:17:07 +0300 |
commit | 8f6f3072e0164d05d314705d02fa6e52741dc983 (patch) | |
tree | 873209d567edb4a2f5bc872270007f76a1506b11 | |
parent | 856676a6b460258e8511093b1bb473f95cc1447a (diff) |
client: Move "gitaly.socket" into global test directory
In order to test relative symlinks in combination with sockets, we
create a relative symlink in our testdata directory. This commit instead
moves it into the global temporary test directory.
-rw-r--r-- | client/dial_test.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/client/dial_test.go b/client/dial_test.go index 29091fc3b..493912838 100644 --- a/client/dial_test.go +++ b/client/dial_test.go @@ -6,6 +6,7 @@ import ( "fmt" "net" "os" + "path/filepath" "strings" "testing" @@ -51,8 +52,14 @@ func TestDial(t *testing.T) { unixSocketAbsPath := connectionMap["unix"] - unixSocketRelPath := "testdata/gitaly.socket" - require.NoError(t, os.RemoveAll(unixSocketRelPath)) + cwd, err := os.Getwd() + require.NoError(t, err) + + tempDir, cleanup := testhelper.TempDir(t) + defer cleanup() + + unixSocketRelPath, err := filepath.Rel(cwd, filepath.Join(tempDir, "gitaly.socket")) + require.NoError(t, err) require.NoError(t, os.Symlink(unixSocketAbsPath, unixSocketRelPath)) tests := []struct { |