diff --git a/config_manager_test.go b/config_manager_test.go index 645ea78..5c7ce95 100644 --- a/config_manager_test.go +++ b/config_manager_test.go @@ -14,12 +14,25 @@ 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)