mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 18:17:52 -05:00
adjust test to match new init function
This commit is contained in:
parent
7728a472f6
commit
caaf7f74f5
@ -40,7 +40,7 @@ func TestSimpleRouter(t *testing.T) {
|
|||||||
mockHs := mocks.NewOutboundHandlerSelector(mockCtl)
|
mockHs := mocks.NewOutboundHandlerSelector(mockCtl)
|
||||||
|
|
||||||
r := new(Router)
|
r := new(Router)
|
||||||
common.Must(r.Init(config, mockDNS, &mockOutboundManager{
|
common.Must(r.Init(context.TODO(), config, mockDNS, &mockOutboundManager{
|
||||||
Manager: mockOhm,
|
Manager: mockOhm,
|
||||||
HandlerSelector: mockHs,
|
HandlerSelector: mockHs,
|
||||||
}))
|
}))
|
||||||
@ -81,7 +81,7 @@ func TestSimpleBalancer(t *testing.T) {
|
|||||||
mockHs.EXPECT().Select(gomock.Eq([]string{"test-"})).Return([]string{"test"})
|
mockHs.EXPECT().Select(gomock.Eq([]string{"test-"})).Return([]string{"test"})
|
||||||
|
|
||||||
r := new(Router)
|
r := new(Router)
|
||||||
common.Must(r.Init(config, mockDNS, &mockOutboundManager{
|
common.Must(r.Init(context.TODO(), config, mockDNS, &mockOutboundManager{
|
||||||
Manager: mockOhm,
|
Manager: mockOhm,
|
||||||
HandlerSelector: mockHs,
|
HandlerSelector: mockHs,
|
||||||
}))
|
}))
|
||||||
@ -119,7 +119,7 @@ func TestIPOnDemand(t *testing.T) {
|
|||||||
mockDNS.EXPECT().LookupIP(gomock.Eq("v2fly.org")).Return([]net.IP{{192, 168, 0, 1}}, nil).AnyTimes()
|
mockDNS.EXPECT().LookupIP(gomock.Eq("v2fly.org")).Return([]net.IP{{192, 168, 0, 1}}, nil).AnyTimes()
|
||||||
|
|
||||||
r := new(Router)
|
r := new(Router)
|
||||||
common.Must(r.Init(config, mockDNS, nil))
|
common.Must(r.Init(context.TODO(), config, mockDNS, nil))
|
||||||
|
|
||||||
ctx := session.ContextWithOutbound(context.Background(), &session.Outbound{Target: net.TCPDestination(net.DomainAddress("v2fly.org"), 80)})
|
ctx := session.ContextWithOutbound(context.Background(), &session.Outbound{Target: net.TCPDestination(net.DomainAddress("v2fly.org"), 80)})
|
||||||
route, err := r.PickRoute(routing_session.AsRoutingContext(ctx))
|
route, err := r.PickRoute(routing_session.AsRoutingContext(ctx))
|
||||||
@ -154,7 +154,7 @@ func TestIPIfNonMatchDomain(t *testing.T) {
|
|||||||
mockDNS.EXPECT().LookupIP(gomock.Eq("v2fly.org")).Return([]net.IP{{192, 168, 0, 1}}, nil).AnyTimes()
|
mockDNS.EXPECT().LookupIP(gomock.Eq("v2fly.org")).Return([]net.IP{{192, 168, 0, 1}}, nil).AnyTimes()
|
||||||
|
|
||||||
r := new(Router)
|
r := new(Router)
|
||||||
common.Must(r.Init(config, mockDNS, nil))
|
common.Must(r.Init(context.TODO(), config, mockDNS, nil))
|
||||||
|
|
||||||
ctx := session.ContextWithOutbound(context.Background(), &session.Outbound{Target: net.TCPDestination(net.DomainAddress("v2fly.org"), 80)})
|
ctx := session.ContextWithOutbound(context.Background(), &session.Outbound{Target: net.TCPDestination(net.DomainAddress("v2fly.org"), 80)})
|
||||||
route, err := r.PickRoute(routing_session.AsRoutingContext(ctx))
|
route, err := r.PickRoute(routing_session.AsRoutingContext(ctx))
|
||||||
@ -188,7 +188,7 @@ func TestIPIfNonMatchIP(t *testing.T) {
|
|||||||
mockDNS := mocks.NewDNSClient(mockCtl)
|
mockDNS := mocks.NewDNSClient(mockCtl)
|
||||||
|
|
||||||
r := new(Router)
|
r := new(Router)
|
||||||
common.Must(r.Init(config, mockDNS, nil))
|
common.Must(r.Init(context.TODO(), config, mockDNS, nil))
|
||||||
|
|
||||||
ctx := session.ContextWithOutbound(context.Background(), &session.Outbound{Target: net.TCPDestination(net.LocalHostIP, 80)})
|
ctx := session.ContextWithOutbound(context.Background(), &session.Outbound{Target: net.TCPDestination(net.LocalHostIP, 80)})
|
||||||
route, err := r.PickRoute(routing_session.AsRoutingContext(ctx))
|
route, err := r.PickRoute(routing_session.AsRoutingContext(ctx))
|
||||||
|
Loading…
Reference in New Issue
Block a user