Fix: module clash-test

This commit is contained in:
yaling888 2022-05-18 04:08:35 +08:00
parent 34eeb58bfa
commit 7a406b991e

View File

@ -8,6 +8,7 @@ import (
"fmt"
"io"
"net"
"net/netip"
"os"
"path/filepath"
"runtime"
@ -38,7 +39,7 @@ const (
var (
waitTime = time.Second
localIP = net.ParseIP("127.0.0.1")
localIP = netip.MustParseAddr("127.0.0.1")
defaultExposedPorts = nat.PortSet{
"10002/tcp": struct{}{},
@ -67,10 +68,11 @@ func init() {
C.SetHomeDir(homeDir)
if isDarwin {
localIP, err = defaultRouteIP()
routeIp, err := defaultRouteIP()
if err != nil {
panic(err)
}
localIP = netip.MustParseAddr(routeIp.String())
}
c, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
@ -309,7 +311,7 @@ func testPingPongWithPacketConn(t *testing.T, pc net.PacketConn) error {
}
defer l.Close()
rAddr := &net.UDPAddr{IP: localIP, Port: 10001}
rAddr := &net.UDPAddr{IP: localIP.AsSlice(), Port: 10001}
pingCh, pongCh, test := newPingPongPair()
go func() {
@ -448,7 +450,7 @@ func testLargeDataWithPacketConn(t *testing.T, pc net.PacketConn) error {
}
defer l.Close()
rAddr := &net.UDPAddr{IP: localIP, Port: 10001}
rAddr := &net.UDPAddr{IP: localIP.AsSlice(), Port: 10001}
times := 50
chunkSize := int64(1024)