remodeling
This commit is contained in:
parent
cc47688990
commit
d2ca696119
|
@ -14,12 +14,25 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLoadConfig(t *testing.T) {
|
func TestLoadConfig(t *testing.T) {
|
||||||
|
|
||||||
|
// notify temp channel
|
||||||
|
ch := make(chan interface{},0)
|
||||||
|
observer.Add(messages.CONFIGMANAGER_LOADED,ch)
|
||||||
|
go func() {
|
||||||
|
data :=<- ch
|
||||||
|
c := data.(config_manager.ConfigManager)
|
||||||
|
cc := c.GetCrawlers()
|
||||||
|
assert.NotEqual(t, len(cc),0)
|
||||||
|
}()
|
||||||
|
|
||||||
|
// make config manager after to load
|
||||||
c := NewConfigManager()
|
c := NewConfigManager()
|
||||||
c.loadGlobalConfig("/root/gowork/src/loafle.com/overflow/config_manager_go/test_agent/global.yaml")
|
c.loadGlobalConfig("/root/gowork/src/loafle.com/overflow/config_manager_go/test_agent/global.yaml")
|
||||||
c.loadCrawlerConfigAll()
|
c.loadCrawlerConfigAll()
|
||||||
|
|
||||||
assert.NotEqual(t, len(c.configs),0)
|
assert.NotEqual(t, len(c.configs),0)
|
||||||
|
observer.Notify(messages.CONFIGMANAGER_LOADED,c)
|
||||||
|
time.Sleep(2 * time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +54,6 @@ func TestAddConfig(t *testing.T) {
|
||||||
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
|
// 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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user