mirror of https://github.com/v2ray/v2ray-core
fix test break
parent
cdb0debcb0
commit
9d2407f4e4
|
@ -13,9 +13,9 @@ func TestServerList(t *testing.T) {
|
||||||
assert := assert.On(t)
|
assert := assert.On(t)
|
||||||
|
|
||||||
list := NewServerList()
|
list := NewServerList()
|
||||||
list.AddServer(NewServerSpec(nil, v2net.TCPDestination(v2net.LocalHostIP, v2net.Port(1)), AlwaysValid()))
|
list.AddServer(NewServerSpec(v2net.TCPDestination(v2net.LocalHostIP, v2net.Port(1)), AlwaysValid()))
|
||||||
assert.Uint32(list.Size()).Equals(1)
|
assert.Uint32(list.Size()).Equals(1)
|
||||||
list.AddServer(NewServerSpec(nil, v2net.TCPDestination(v2net.LocalHostIP, v2net.Port(2)), BeforeTime(time.Now().Add(time.Second))))
|
list.AddServer(NewServerSpec(v2net.TCPDestination(v2net.LocalHostIP, v2net.Port(2)), BeforeTime(time.Now().Add(time.Second))))
|
||||||
assert.Uint32(list.Size()).Equals(2)
|
assert.Uint32(list.Size()).Equals(2)
|
||||||
|
|
||||||
server := list.GetServer(1)
|
server := list.GetServer(1)
|
||||||
|
@ -32,9 +32,9 @@ func TestServerPicker(t *testing.T) {
|
||||||
assert := assert.On(t)
|
assert := assert.On(t)
|
||||||
|
|
||||||
list := NewServerList()
|
list := NewServerList()
|
||||||
list.AddServer(NewServerSpec(nil, v2net.TCPDestination(v2net.LocalHostIP, v2net.Port(1)), AlwaysValid()))
|
list.AddServer(NewServerSpec(v2net.TCPDestination(v2net.LocalHostIP, v2net.Port(1)), AlwaysValid()))
|
||||||
list.AddServer(NewServerSpec(nil, v2net.TCPDestination(v2net.LocalHostIP, v2net.Port(2)), BeforeTime(time.Now().Add(time.Second))))
|
list.AddServer(NewServerSpec(v2net.TCPDestination(v2net.LocalHostIP, v2net.Port(2)), BeforeTime(time.Now().Add(time.Second))))
|
||||||
list.AddServer(NewServerSpec(nil, v2net.TCPDestination(v2net.LocalHostIP, v2net.Port(3)), BeforeTime(time.Now().Add(time.Second))))
|
list.AddServer(NewServerSpec(v2net.TCPDestination(v2net.LocalHostIP, v2net.Port(3)), BeforeTime(time.Now().Add(time.Second))))
|
||||||
|
|
||||||
picker := NewRoundRobinServerPicker(list)
|
picker := NewRoundRobinServerPicker(list)
|
||||||
server := picker.PickServer()
|
server := picker.PickServer()
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"v2ray.com/core/common/protocol"
|
"v2ray.com/core/common/protocol"
|
||||||
"v2ray.com/core/proxy/vmess"
|
|
||||||
"v2ray.com/core/proxy/vmess/outbound"
|
"v2ray.com/core/proxy/vmess/outbound"
|
||||||
"v2ray.com/core/testing/assert"
|
"v2ray.com/core/testing/assert"
|
||||||
. "v2ray.com/core/tools/conf"
|
. "v2ray.com/core/tools/conf"
|
||||||
|
@ -40,6 +39,6 @@ func TestConfigTargetParsing(t *testing.T) {
|
||||||
|
|
||||||
config := iConfig.(*outbound.Config)
|
config := iConfig.(*outbound.Config)
|
||||||
specPB := config.Receiver[0]
|
specPB := config.Receiver[0]
|
||||||
spec := protocol.NewServerSpecFromPB(vmess.NewAccount, *specPB)
|
spec := protocol.NewServerSpecFromPB(*specPB)
|
||||||
assert.Destination(spec.Destination()).EqualsString("tcp:127.0.0.1:80")
|
assert.Destination(spec.Destination()).EqualsString("tcp:127.0.0.1:80")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue