From cc4768899038d2e199762fa7a172aa69f4558b32 Mon Sep 17 00:00:00 2001 From: "jackdaw@loafle.com" Date: Thu, 27 Apr 2017 19:03:26 +0900 Subject: [PATCH] remodeling --- config_manager_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/config_manager_test.go b/config_manager_test.go index 6c56af1..645ea78 100644 --- a/config_manager_test.go +++ b/config_manager_test.go @@ -27,19 +27,22 @@ func TestAddConfig(t *testing.T) { _configManager.loadGlobalConfig("/root/gowork/src/loafle.com/overflow/config_manager_go/test_agent/global.yaml") + // 원본 테스트 설정 파일 로드 b, err := ioutil.ReadFile("/root/gowork/src/loafle.com/overflow/config_manager_go/test_agent/test.json") if err != nil { log.Panic(err) } - var m = config_manager.Config{} json.Unmarshal(b, &m) - + + // uuid로 원본 파일 복제 rid,_ := uuid.NewRandom() m.Id = rid.String() b,err = json.Marshal(&m) ioutil.WriteFile("/root/gowork/src/loafle.com/overflow/config_manager_go/test_agent/" + m.Id,b,0644) + + // add test observer.Notify(messages.ADD_SENSOR_0,"/root/gowork/src/loafle.com/overflow/config_manager_go/test_agent/" + m.Id) time.Sleep(1 * time.Second) } @@ -50,6 +53,7 @@ func TestRemoveConfig(t *testing.T) { _configManager.loadGlobalConfig("/root/gowork/src/loafle.com/overflow/config_manager_go/test_agent/global.yaml") _configManager.loadCrawlerConfigAll() + // remove test observer.Notify(messages.REMOVE_SENSOR_0,"289575d2-4a34-4475-b91d-7fb0992cc3de") time.Sleep(1 * time.Second) }