From b923860b1a509738422fff8cef826da5d0abcd66 Mon Sep 17 00:00:00 2001 From: snoop Date: Mon, 17 Apr 2017 13:48:53 +0900 Subject: [PATCH] added test environment --- crawler_manager.go | 6 +++--- crawler_manager_test.go | 20 +++++++++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/crawler_manager.go b/crawler_manager.go index b1a981c..15ba1a9 100644 --- a/crawler_manager.go +++ b/crawler_manager.go @@ -21,8 +21,8 @@ const ( portArgsName = "-Port=" defaultPort = 50000 - rootFolder = "/home/cm/" - ConfigFolder = rootFolder + "/config/" // +container + rootFolder = "/home/cm2/" + ConfigFolder = rootFolder + "/config/container/" // +container BinaryFolder = rootFolder + "/container/" PidFolder = rootFolder + "/pids/" 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.init() + //g_CrawlerMananger.init() } func (c *CrawlerManager)GetClient(container string) (*grpc.ClientConn, error) { diff --git a/crawler_manager_test.go b/crawler_manager_test.go index 5afb13c..666acb2 100644 --- a/crawler_manager_test.go +++ b/crawler_manager_test.go @@ -11,6 +11,8 @@ import ( "strings" "io/ioutil" + + ) @@ -127,6 +129,8 @@ func TestDir22(t *testing.T) { func TestCrateDir(t *testing.T) { + cp := "/home/snoop/develop/path/go/src/loafle.com/overflow/crawler_manager_go/" + var configPath []string; @@ -149,10 +153,7 @@ func TestCrateDir(t *testing.T) { containerPath = append(containerPath, PidFolder) - - - - b, _:=ioutil.ReadFile("/home/snoop/develop/path/go/src/loafle.com/overflow/crawler_go/config/example.json") + b, _:=ioutil.ReadFile(cp + "config/example.json") for i, p := range configPath { pp := filepath.Join(p) @@ -164,10 +165,17 @@ func TestCrateDir(t *testing.T) { } + + bbb, _:=ioutil.ReadFile(cp + "config/ttnc") + for _, p := range containerPath { pp := filepath.Join(p) 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)) -} \ No newline at end of file +} + +