fs/torrentfs_test.go | 12 ++++++------ diff --git a/fs/torrentfs_test.go b/fs/torrentfs_test.go index 8c48a00601603cf53012f93e08c1c4432380da87..ba8b5a483779fd671e95ff0b3ad72ee69b74c88d 100644 --- a/fs/torrentfs_test.go +++ b/fs/torrentfs_test.go @@ -28,12 +28,7 @@ go http.ListenAndServe(":6061", nil) } 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 @@ t.Fatal(err) } 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() }