agent observer message modify

This commit is contained in:
geek 2017-05-11 19:00:52 +09:00
parent 907fb38f0a
commit 929db3d1d5

View File

@ -17,7 +17,7 @@ func TestLoadConfig(t *testing.T) {
// notify temp channel
ch := make(chan interface{},0)
observer.Add(messages.CONFIGMANAGER_LOADED,ch)
observer.Add(messages.CFG_LOADED,ch)
go func() {
data :=<- ch
c := data.(config_manager.ConfigManager)
@ -31,7 +31,7 @@ func TestLoadConfig(t *testing.T) {
c.loadCrawlerConfigAll()
assert.NotEqual(t, len(c.configs),0)
observer.Notify(messages.CONFIGMANAGER_LOADED,c)
observer.Notify(messages.CFG_LOADED,c)
time.Sleep(1 * time.Second)
}
@ -54,7 +54,7 @@ func TestAddConfig(t *testing.T) {
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.TASK_SENSOR_ADD,"/root/gowork/src/loafle.com/overflow/config_manager_go/test_agent/" + m.Id)
time.Sleep(1 * time.Second)
}
@ -65,6 +65,6 @@ func TestRemoveConfig(t *testing.T) {
_configManager.loadCrawlerConfigAll()
// remove test
observer.Notify(messages.REMOVE_SENSOR_0,"d0fcc7b1-43a7-4acd-a7bf-c9572a9d4c9e")
observer.Notify(messages.TASK_SENSOR_REMOVE,"d0fcc7b1-43a7-4acd-a7bf-c9572a9d4c9e")
time.Sleep(1 * time.Second)
}