fix test break

pull/56/head
Darien Raymond 9 years ago
parent 3327cb0b80
commit 30be218c62

@ -4,7 +4,7 @@
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": false,
"udp": true,
"ip": "127.0.0.1"
}
},

@ -12,6 +12,28 @@ import (
"github.com/v2ray/v2ray-core/testing/servers/udp"
)
var (
serverUp = false
)
func setupServer() error {
if serverUp {
return nil
}
err := InitializeServer(TestFile("test_1_client.json"))
if err != nil {
return err
}
err = InitializeServer(TestFile("test_1_server.json"))
if err != nil {
return err
}
serverUp = true
return nil
}
func TestTCPConnection(t *testing.T) {
v2testing.Current(t)
@ -28,11 +50,7 @@ func TestTCPConnection(t *testing.T) {
_, err := tcpServer.Start()
assert.Error(err).IsNil()
err = InitializeServer(TestFile("test_1_client.json"))
assert.Error(err).IsNil()
err = InitializeServer(TestFile("test_1_server.json"))
assert.Error(err).IsNil()
assert.Error(setupServer()).IsNil()
socksPort := v2net.Port(50000)
@ -99,11 +117,7 @@ func TestTCPBind(t *testing.T) {
_, err := tcpServer.Start()
assert.Error(err).IsNil()
err = InitializeServer(TestFile("test_1_client.json"))
assert.Error(err).IsNil()
err = InitializeServer(TestFile("test_1_server.json"))
assert.Error(err).IsNil()
assert.Error(setupServer()).IsNil()
socksPort := v2net.Port(50000)
@ -151,11 +165,7 @@ func TestUDPAssociate(t *testing.T) {
_, err := udpServer.Start()
assert.Error(err).IsNil()
err = InitializeServer(TestFile("test_1_client.json"))
assert.Error(err).IsNil()
err = InitializeServer(TestFile("test_1_server.json"))
assert.Error(err).IsNil()
assert.Error(setupServer()).IsNil()
socksPort := v2net.Port(50000)

Loading…
Cancel
Save