From 8518b54cde319b4b35e02f740c87cf614130c438 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Wed, 19 Nov 2014 20:01:03 -0600 Subject: [PATCH] torrentfs tests: Use dynamic port --- fs/torrentfs_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/torrentfs_test.go b/fs/torrentfs_test.go index 8c48a006..ba8b5a48 100644 --- a/fs/torrentfs_test.go +++ b/fs/torrentfs_test.go @@ -28,12 +28,7 @@ func init() { } func TestTCPAddrString(t *testing.T) { - ta := &net.TCPAddr{ - IP: net.IPv4(127, 0, 0, 1), - Port: 3000, - } - s := ta.String() - l, err := net.Listen("tcp4", "localhost:3000") + l, err := net.Listen("tcp4", "localhost:0") if err != nil { t.Fatal(err) } @@ -44,6 +39,11 @@ func TestTCPAddrString(t *testing.T) { } defer c.Close() ras := c.RemoteAddr().String() + ta := &net.TCPAddr{ + IP: net.IPv4(127, 0, 0, 1), + Port: util.AddrPort(l.Addr()), + } + s := ta.String() if ras != s { t.FailNow() } -- 2.48.1