From 418b4996eaa144da57508f9cca39eec02ef11d79 Mon Sep 17 00:00:00 2001 From: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Date: Sun, 26 Sep 2021 19:16:07 -0400 Subject: [PATCH] Fix some tests to use udp.PickPort() --- testing/scenarios/dokodemo_test.go | 2 +- testing/scenarios/feature_test.go | 2 +- testing/scenarios/shadowsocks_test.go | 6 +++--- testing/scenarios/transport_test.go | 3 ++- testing/scenarios/vmess_test.go | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/testing/scenarios/dokodemo_test.go b/testing/scenarios/dokodemo_test.go index 0fcc21a063f..a63b859500d 100644 --- a/testing/scenarios/dokodemo_test.go +++ b/testing/scenarios/dokodemo_test.go @@ -156,7 +156,7 @@ func TestDokodemoUDP(t *testing.T) { }, } - clientPort := uint32(tcp.PickPort()) + clientPort := uint32(udp.PickPort()) clientPortRange := uint32(5) clientConfig := &core.Config{ Inbound: []*core.InboundHandlerConfig{ diff --git a/testing/scenarios/feature_test.go b/testing/scenarios/feature_test.go index 5e822bd3deb..9455ff6df54 100644 --- a/testing/scenarios/feature_test.go +++ b/testing/scenarios/feature_test.go @@ -512,7 +512,7 @@ func TestUDPConnection(t *testing.T) { common.Must(err) defer udpServer.Close() - clientPort := tcp.PickPort() + clientPort := udp.PickPort() clientConfig := &core.Config{ Inbound: []*core.InboundHandlerConfig{ { diff --git a/testing/scenarios/shadowsocks_test.go b/testing/scenarios/shadowsocks_test.go index b6ff212e091..628476c71e7 100644 --- a/testing/scenarios/shadowsocks_test.go +++ b/testing/scenarios/shadowsocks_test.go @@ -215,7 +215,7 @@ func TestShadowsocksAES128GCMUDP(t *testing.T) { CipherType: shadowsocks.CipherType_AES_128_GCM, }) - serverPort := tcp.PickPort() + serverPort := udp.PickPort() serverConfig := &core.Config{ App: []*serial.TypedMessage{ serial.ToTypedMessage(&log.Config{ @@ -245,7 +245,7 @@ func TestShadowsocksAES128GCMUDP(t *testing.T) { }, } - clientPort := tcp.PickPort() + clientPort := udp.PickPort() clientConfig := &core.Config{ App: []*serial.TypedMessage{ serial.ToTypedMessage(&log.Config{ @@ -341,7 +341,7 @@ func TestShadowsocksAES128GCMUDPMux(t *testing.T) { }, } - clientPort := tcp.PickPort() + clientPort := udp.PickPort() clientConfig := &core.Config{ App: []*serial.TypedMessage{ serial.ToTypedMessage(&log.Config{ diff --git a/testing/scenarios/transport_test.go b/testing/scenarios/transport_test.go index 1a78abdbd29..4475275651c 100644 --- a/testing/scenarios/transport_test.go +++ b/testing/scenarios/transport_test.go @@ -23,6 +23,7 @@ import ( "github.com/v2fly/v2ray-core/v4/proxy/vmess/inbound" "github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound" "github.com/v2fly/v2ray-core/v4/testing/servers/tcp" + "github.com/v2fly/v2ray-core/v4/testing/servers/udp" "github.com/v2fly/v2ray-core/v4/transport/internet" "github.com/v2fly/v2ray-core/v4/transport/internet/domainsocket" "github.com/v2fly/v2ray-core/v4/transport/internet/headers/http" @@ -257,7 +258,7 @@ func TestVMessQuic(t *testing.T) { defer tcpServer.Close() userID := protocol.NewID(uuid.New()) - serverPort := tcp.PickPort() + serverPort := udp.PickPort() serverConfig := &core.Config{ App: []*serial.TypedMessage{ serial.ToTypedMessage(&log.Config{ diff --git a/testing/scenarios/vmess_test.go b/testing/scenarios/vmess_test.go index 96db0940693..72d1f9cdbd2 100644 --- a/testing/scenarios/vmess_test.go +++ b/testing/scenarios/vmess_test.go @@ -403,7 +403,7 @@ func TestVMessGCMUDP(t *testing.T) { }, } - clientPort := tcp.PickPort() + clientPort := udp.PickPort() clientConfig := &core.Config{ App: []*serial.TypedMessage{ serial.ToTypedMessage(&log.Config{