remodeling

This commit is contained in:
jackdaw@loafle.com 2017-04-27 19:10:36 +09:00
parent cc47688990
commit d2ca696119

View File

@ -15,11 +15,24 @@ import (
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.loadGlobalConfig("/root/gowork/src/loafle.com/overflow/config_manager_go/test_agent/global.yaml")
c.loadCrawlerConfigAll()
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)
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)