From df2d5b5d75a2d30e35ea5c4644f612db5f5ce2fa Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Thu, 8 Nov 2018 01:01:53 +0100 Subject: [PATCH] fix broken tests --- testing/scenarios/command_test.go | 12 +++++++++--- testing/scenarios/dns_test.go | 4 +++- testing/scenarios/feature_test.go | 12 +++++++++--- testing/scenarios/reverse_test.go | 32 +++++++++++++++++++++++-------- testing/scenarios/socks_test.go | 4 +++- 5 files changed, 48 insertions(+), 16 deletions(-) diff --git a/testing/scenarios/command_test.go b/testing/scenarios/command_test.go index bf498dd53..eab1bf337 100644 --- a/testing/scenarios/command_test.go +++ b/testing/scenarios/command_test.go @@ -56,7 +56,9 @@ func TestCommanderRemoveHandler(t *testing.T) { Rule: []*router.RoutingRule{ { InboundTag: []string{"api"}, - Tag: "api", + TargetTag: &router.RoutingRule_Tag{ + Tag: "api", + }, }, }, }), @@ -173,7 +175,9 @@ func TestCommanderAddRemoveUser(t *testing.T) { Rule: []*router.RoutingRule{ { InboundTag: []string{"api"}, - Tag: "api", + TargetTag: &router.RoutingRule_Tag{ + Tag: "api", + }, }, }, }), @@ -381,7 +385,9 @@ func TestCommanderStats(t *testing.T) { Rule: []*router.RoutingRule{ { InboundTag: []string{"api"}, - Tag: "api", + TargetTag: &router.RoutingRule_Tag{ + Tag: "api", + }, }, }, }), diff --git a/testing/scenarios/dns_test.go b/testing/scenarios/dns_test.go index bb9e92ac7..41ef84ad5 100644 --- a/testing/scenarios/dns_test.go +++ b/testing/scenarios/dns_test.go @@ -46,7 +46,9 @@ func TestResolveIP(t *testing.T) { Prefix: 8, }, }, - Tag: "direct", + TargetTag: &router.RoutingRule_Tag{ + Tag: "direct", + }, }, }, }), diff --git a/testing/scenarios/feature_test.go b/testing/scenarios/feature_test.go index 84aaaccd8..815ac3070 100644 --- a/testing/scenarios/feature_test.go +++ b/testing/scenarios/feature_test.go @@ -475,7 +475,9 @@ func TestBlackhole(t *testing.T) { serial.ToTypedMessage(&router.Config{ Rule: []*router.RoutingRule{ { - Tag: "blocked", + TargetTag: &router.RoutingRule_Tag{ + Tag: "blocked", + }, PortRange: net.SinglePortRange(dest2.Port), }, }, @@ -714,10 +716,14 @@ func TestDomainSniffing(t *testing.T) { serial.ToTypedMessage(&router.Config{ Rule: []*router.RoutingRule{ { - Tag: "direct", + TargetTag: &router.RoutingRule_Tag{ + Tag: "direct", + }, InboundTag: []string{"snif"}, }, { - Tag: "redir", + TargetTag: &router.RoutingRule_Tag{ + Tag: "redir", + }, InboundTag: []string{"http"}, }, }, diff --git a/testing/scenarios/reverse_test.go b/testing/scenarios/reverse_test.go index 0f42572d3..bb1020ea3 100644 --- a/testing/scenarios/reverse_test.go +++ b/testing/scenarios/reverse_test.go @@ -57,11 +57,15 @@ func TestReverseProxy(t *testing.T) { Domain: []*router.Domain{ {Type: router.Domain_Full, Value: "test.v2ray.com"}, }, - Tag: "portal", + TargetTag: &router.RoutingRule_Tag{ + Tag: "portal", + }, }, { InboundTag: []string{"external"}, - Tag: "portal", + TargetTag: &router.RoutingRule_Tag{ + Tag: "portal", + }, }, }, }), @@ -122,11 +126,15 @@ func TestReverseProxy(t *testing.T) { Domain: []*router.Domain{ {Type: router.Domain_Full, Value: "test.v2ray.com"}, }, - Tag: "reverse", + TargetTag: &router.RoutingRule_Tag{ + Tag: "reverse", + }, }, { InboundTag: []string{"bridge"}, - Tag: "freedom", + TargetTag: &router.RoutingRule_Tag{ + Tag: "freedom", + }, }, }, }), @@ -256,11 +264,15 @@ func TestReverseProxyLongRunning(t *testing.T) { Domain: []*router.Domain{ {Type: router.Domain_Full, Value: "test.v2ray.com"}, }, - Tag: "portal", + TargetTag: &router.RoutingRule_Tag{ + Tag: "portal", + }, }, { InboundTag: []string{"external"}, - Tag: "portal", + TargetTag: &router.RoutingRule_Tag{ + Tag: "portal", + }, }, }, }), @@ -335,11 +347,15 @@ func TestReverseProxyLongRunning(t *testing.T) { Domain: []*router.Domain{ {Type: router.Domain_Full, Value: "test.v2ray.com"}, }, - Tag: "reverse", + TargetTag: &router.RoutingRule_Tag{ + Tag: "reverse", + }, }, { InboundTag: []string{"bridge"}, - Tag: "freedom", + TargetTag: &router.RoutingRule_Tag{ + Tag: "freedom", + }, }, }, }), diff --git a/testing/scenarios/socks_test.go b/testing/scenarios/socks_test.go index a87a43653..7859a5907 100644 --- a/testing/scenarios/socks_test.go +++ b/testing/scenarios/socks_test.go @@ -231,7 +231,9 @@ func TestSocksBridageUDPWithRouting(t *testing.T) { serial.ToTypedMessage(&router.Config{ Rule: []*router.RoutingRule{ { - Tag: "out", + TargetTag: &router.RoutingRule_Tag{ + Tag: "out", + }, InboundTag: []string{"socks"}, }, },