agent observer message modify
This commit is contained in:
parent
907fb38f0a
commit
929db3d1d5
|
@ -17,7 +17,7 @@ func TestLoadConfig(t *testing.T) {
|
||||||
|
|
||||||
// notify temp channel
|
// notify temp channel
|
||||||
ch := make(chan interface{},0)
|
ch := make(chan interface{},0)
|
||||||
observer.Add(messages.CONFIGMANAGER_LOADED,ch)
|
observer.Add(messages.CFG_LOADED,ch)
|
||||||
go func() {
|
go func() {
|
||||||
data :=<- ch
|
data :=<- ch
|
||||||
c := data.(config_manager.ConfigManager)
|
c := data.(config_manager.ConfigManager)
|
||||||
|
@ -31,7 +31,7 @@ func TestLoadConfig(t *testing.T) {
|
||||||
c.loadCrawlerConfigAll()
|
c.loadCrawlerConfigAll()
|
||||||
|
|
||||||
assert.NotEqual(t, len(c.configs),0)
|
assert.NotEqual(t, len(c.configs),0)
|
||||||
observer.Notify(messages.CONFIGMANAGER_LOADED,c)
|
observer.Notify(messages.CFG_LOADED,c)
|
||||||
time.Sleep(1 * time.Second)
|
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)
|
ioutil.WriteFile("/root/gowork/src/loafle.com/overflow/config_manager_go/test_agent/" + m.Id,b,0644)
|
||||||
|
|
||||||
// add test
|
// 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)
|
time.Sleep(1 * time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,6 @@ func TestRemoveConfig(t *testing.T) {
|
||||||
_configManager.loadCrawlerConfigAll()
|
_configManager.loadCrawlerConfigAll()
|
||||||
|
|
||||||
// remove test
|
// 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)
|
time.Sleep(1 * time.Second)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user