test environment
This commit is contained in:
snoop 2017-04-17 13:48:53 +09:00
parent 837b3070bb
commit b923860b1a
2 changed files with 18 additions and 8 deletions

View File

@ -21,8 +21,8 @@ const (
portArgsName = "-Port=" portArgsName = "-Port="
defaultPort = 50000 defaultPort = 50000
rootFolder = "/home/cm/" rootFolder = "/home/cm2/"
ConfigFolder = rootFolder + "/config/" // +container ConfigFolder = rootFolder + "/config/container/" // +container
BinaryFolder = rootFolder + "/container/" BinaryFolder = rootFolder + "/container/"
PidFolder = rootFolder + "/pids/" PidFolder = rootFolder + "/pids/"
runFile = "ttnc" runFile = "ttnc"
@ -42,7 +42,7 @@ func init() {
g_CrawlerMananger = &CrawlerManager{portMap:make(map[string]string),pidMap:make(map[string]string), currentPort:defaultPort} g_CrawlerMananger = &CrawlerManager{portMap:make(map[string]string),pidMap:make(map[string]string), currentPort:defaultPort}
} }
g_CrawlerMananger.init() //g_CrawlerMananger.init()
} }
func (c *CrawlerManager)GetClient(container string) (*grpc.ClientConn, error) { func (c *CrawlerManager)GetClient(container string) (*grpc.ClientConn, error) {

View File

@ -11,6 +11,8 @@ import (
"strings" "strings"
"io/ioutil" "io/ioutil"
) )
@ -127,6 +129,8 @@ func TestDir22(t *testing.T) {
func TestCrateDir(t *testing.T) { func TestCrateDir(t *testing.T) {
cp := "/home/snoop/develop/path/go/src/loafle.com/overflow/crawler_manager_go/"
var configPath []string; var configPath []string;
@ -149,10 +153,7 @@ func TestCrateDir(t *testing.T) {
containerPath = append(containerPath, PidFolder) containerPath = append(containerPath, PidFolder)
b, _:=ioutil.ReadFile(cp + "config/example.json")
b, _:=ioutil.ReadFile("/home/snoop/develop/path/go/src/loafle.com/overflow/crawler_go/config/example.json")
for i, p := range configPath { for i, p := range configPath {
pp := filepath.Join(p) pp := filepath.Join(p)
@ -164,10 +165,17 @@ func TestCrateDir(t *testing.T) {
} }
bbb, _:=ioutil.ReadFile(cp + "config/ttnc")
for _, p := range containerPath { for _, p := range containerPath {
pp := filepath.Join(p) pp := filepath.Join(p)
os.MkdirAll(pp, os.ModePerm) os.MkdirAll(pp, os.ModePerm)
pp += "/"
pp += "/ttnc"
ioutil.WriteFile(pp, bbb, os.ModePerm)
} }
} }
@ -279,4 +287,6 @@ func TestErer(t *testing.T) {
t.Log(len(asdf)) t.Log(len(asdf))
} }