mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 11:05:45 +00:00
safesocket: create the test socket in a temp dir
This allows the test to be run inside a mounted filesystem, which I'm doing now as a I develop on a linux VM. Fixes #2367. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
parent
254fc7885b
commit
7a08c159e6
@ -6,11 +6,17 @@
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBasics(t *testing.T) {
|
func TestBasics(t *testing.T) {
|
||||||
l, port, err := Listen("test", 0)
|
// Make the socket in a temp dir rather than the cwd
|
||||||
|
// so that the test can be run from a mounted filesystem (#2367).
|
||||||
|
dir := t.TempDir()
|
||||||
|
sock := filepath.Join(dir, "test")
|
||||||
|
|
||||||
|
l, port, err := Listen(sock, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -42,7 +48,7 @@ func TestBasics(t *testing.T) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
c, err := Connect("test", port)
|
c, err := Connect(sock, port)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errs <- err
|
errs <- err
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user