Skip to content

Commit 69ce4d0

Browse files
committed
chore: speed up inbound test
1 parent b59f11f commit 69ce4d0

File tree

8 files changed

+31
-18
lines changed

8 files changed

+31
-18
lines changed

listener/inbound/anytls_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
)
1212

1313
func testInboundAnyTLS(t *testing.T, inboundOptions inbound.AnyTLSOption, outboundOptions outbound.AnyTLSOption) {
14+
t.Parallel()
1415
inboundOptions.BaseOption = inbound.BaseOption{
1516
NameStr: "anytls_inbound",
1617
Listen: "127.0.0.1",

listener/inbound/hysteria2_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
)
1212

1313
func testInboundHysteria2(t *testing.T, inboundOptions inbound.Hysteria2Option, outboundOptions outbound.Hysteria2Option) {
14+
t.Parallel()
1415
inboundOptions.BaseOption = inbound.BaseOption{
1516
NameStr: "hysteria2_inbound",
1617
Listen: "127.0.0.1",

listener/inbound/mux_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ func (n *notCloseProxyAdapter) Close() error {
2424
func testSingMux(t *testing.T, tunnel *TestTunnel, out outbound.ProxyAdapter) {
2525
t.Run("singmux", func(t *testing.T) {
2626
for _, protocol := range singMuxProtocolList {
27+
protocol := protocol
2728
t.Run(protocol, func(t *testing.T) {
2829
t.Parallel()
2930
singMuxOption := outbound.SingMuxOption{

listener/inbound/shadowsocks_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ func init() {
3232
}
3333

3434
func testInboundShadowSocks(t *testing.T, inboundOptions inbound.ShadowSocksOption, outboundOptions outbound.ShadowSocksOption) {
35+
t.Parallel()
3536
for _, cipher := range shadowsocksCipherList {
37+
cipher := cipher
3638
t.Run(cipher, func(t *testing.T) {
37-
t.Parallel()
3839
inboundOptions, outboundOptions := inboundOptions, outboundOptions // don't modify outside options value
3940
inboundOptions.Cipher = cipher
4041
outboundOptions.Cipher = cipher
@@ -44,6 +45,7 @@ func testInboundShadowSocks(t *testing.T, inboundOptions inbound.ShadowSocksOpti
4445
}
4546

4647
func testInboundShadowSocks0(t *testing.T, inboundOptions inbound.ShadowSocksOption, outboundOptions outbound.ShadowSocksOption) {
48+
t.Parallel()
4749
password := shadowsocksPassword32
4850
if strings.Contains(inboundOptions.Cipher, "-128-") {
4951
password = shadowsocksPassword16

listener/inbound/trojan_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
)
1212

1313
func testInboundTrojan(t *testing.T, inboundOptions inbound.TrojanOption, outboundOptions outbound.TrojanOption) {
14+
t.Parallel()
1415
inboundOptions.BaseOption = inbound.BaseOption{
1516
NameStr: "trojan_inbound",
1617
Listen: "127.0.0.1",

listener/inbound/tuic_test.go

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,35 @@ import (
1313
var tuicCCs = []string{"cubic", "new_reno", "bbr"}
1414

1515
func testInboundTuic(t *testing.T, inboundOptions inbound.TuicOption, outboundOptions outbound.TuicOption) {
16+
t.Parallel()
1617
inboundOptions.Users = map[string]string{userUUID: userUUID}
1718
inboundOptions.Token = []string{userUUID}
1819

1920
for _, tuicCC := range tuicCCs {
20-
t.Run("v4", func(t *testing.T) {
21+
tuicCC := tuicCC
22+
t.Run(tuicCC, func(t *testing.T) {
2123
t.Parallel()
22-
inboundOptions, outboundOptions := inboundOptions, outboundOptions // don't modify outside options value
23-
outboundOptions.Token = userUUID
24-
outboundOptions.CongestionController = tuicCC
25-
inboundOptions.CongestionController = tuicCC
26-
testInboundTuic0(t, inboundOptions, outboundOptions)
27-
})
28-
t.Run("v5", func(t *testing.T) {
29-
t.Parallel()
30-
inboundOptions, outboundOptions := inboundOptions, outboundOptions // don't modify outside options value
31-
outboundOptions.UUID = userUUID
32-
outboundOptions.Password = userUUID
33-
outboundOptions.CongestionController = tuicCC
34-
inboundOptions.CongestionController = tuicCC
35-
testInboundTuic0(t, inboundOptions, outboundOptions)
24+
t.Run("v4", func(t *testing.T) {
25+
inboundOptions, outboundOptions := inboundOptions, outboundOptions // don't modify outside options value
26+
outboundOptions.Token = userUUID
27+
outboundOptions.CongestionController = tuicCC
28+
inboundOptions.CongestionController = tuicCC
29+
testInboundTuic0(t, inboundOptions, outboundOptions)
30+
})
31+
t.Run("v5", func(t *testing.T) {
32+
inboundOptions, outboundOptions := inboundOptions, outboundOptions // don't modify outside options value
33+
outboundOptions.UUID = userUUID
34+
outboundOptions.Password = userUUID
35+
outboundOptions.CongestionController = tuicCC
36+
inboundOptions.CongestionController = tuicCC
37+
testInboundTuic0(t, inboundOptions, outboundOptions)
38+
})
3639
})
3740
}
3841
}
3942

4043
func testInboundTuic0(t *testing.T, inboundOptions inbound.TuicOption, outboundOptions outbound.TuicOption) {
44+
t.Parallel()
4145
inboundOptions.BaseOption = inbound.BaseOption{
4246
NameStr: "tuic_inbound",
4347
Listen: "127.0.0.1",
@@ -69,8 +73,9 @@ func testInboundTuic0(t *testing.T, inboundOptions inbound.TuicOption, outboundO
6973

7074
func TestInboundTuic_TLS(t *testing.T) {
7175
inboundOptions := inbound.TuicOption{
72-
Certificate: tlsCertificate,
73-
PrivateKey: tlsPrivateKey,
76+
Certificate: tlsCertificate,
77+
PrivateKey: tlsPrivateKey,
78+
AuthenticationTimeout: 5000,
7479
}
7580
outboundOptions := outbound.TuicOption{
7681
Fingerprint: tlsFingerprint,

listener/inbound/vless_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
)
1212

1313
func testInboundVless(t *testing.T, inboundOptions inbound.VlessOption, outboundOptions outbound.VlessOption) {
14+
t.Parallel()
1415
inboundOptions.BaseOption = inbound.BaseOption{
1516
NameStr: "vless_inbound",
1617
Listen: "127.0.0.1",

listener/inbound/vmess_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
)
1212

1313
func testInboundVMess(t *testing.T, inboundOptions inbound.VmessOption, outboundOptions outbound.VmessOption) {
14+
t.Parallel()
1415
inboundOptions.BaseOption = inbound.BaseOption{
1516
NameStr: "vmess_inbound",
1617
Listen: "127.0.0.1",

0 commit comments

Comments
 (0)