remodeling

This commit is contained in:
jackdaw@loafle.com 2017-04-27 19:03:26 +09:00
parent 5c5d1844a2
commit cc47688990

View File

@ -27,19 +27,22 @@ func TestAddConfig(t *testing.T) {
_configManager.loadGlobalConfig("/root/gowork/src/loafle.com/overflow/config_manager_go/test_agent/global.yaml") _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") b, err := ioutil.ReadFile("/root/gowork/src/loafle.com/overflow/config_manager_go/test_agent/test.json")
if err != nil { if err != nil {
log.Panic(err) log.Panic(err)
} }
var m = config_manager.Config{} var m = config_manager.Config{}
json.Unmarshal(b, &m) json.Unmarshal(b, &m)
// uuid로 원본 파일 복제
rid,_ := uuid.NewRandom() rid,_ := uuid.NewRandom()
m.Id = rid.String() m.Id = rid.String()
b,err = json.Marshal(&m) b,err = json.Marshal(&m)
ioutil.WriteFile("/root/gowork/src/loafle.com/overflow/config_manager_go/test_agent/" + m.Id,b,0644) 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) observer.Notify(messages.ADD_SENSOR_0,"/root/gowork/src/loafle.com/overflow/config_manager_go/test_agent/" + m.Id)
time.Sleep(1 * time.Second) 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.loadGlobalConfig("/root/gowork/src/loafle.com/overflow/config_manager_go/test_agent/global.yaml")
_configManager.loadCrawlerConfigAll() _configManager.loadCrawlerConfigAll()
// remove test
observer.Notify(messages.REMOVE_SENSOR_0,"289575d2-4a34-4475-b91d-7fb0992cc3de") observer.Notify(messages.REMOVE_SENSOR_0,"289575d2-4a34-4475-b91d-7fb0992cc3de")
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
} }