1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-28 13:05:28 -05:00

more test cases

This commit is contained in:
Darien Raymond
2015-12-04 16:32:42 +00:00
parent 30be218c62
commit 5ec30c3ad0
8 changed files with 264 additions and 28 deletions

View File

@@ -24,10 +24,30 @@ import (
_ "github.com/v2ray/v2ray-core/proxy/vmess/config/json"
)
var (
serverup = make(map[string]bool)
)
func TestFile(filename string) string {
return filepath.Join(os.Getenv("GOPATH"), "src", "github.com", "v2ray", "v2ray-core", "testing", "scenarios", "data", filename)
}
func InitializeServerSetOnce(testcase string) error {
if up, found := serverup[testcase]; found && up {
return nil
}
err := InitializeServer(TestFile(testcase + "_server.json"))
if err != nil {
return err
}
err = InitializeServer(TestFile(testcase + "_client.json"))
if err != nil {
return err
}
serverup[testcase] = true
return nil
}
func InitializeServer(configFile string) error {
config, err := jsonconf.LoadConfig(configFile)
if err != nil {