func TestRefreshPipeline(t *testing.T) { one := []byte(`{ "api_port": 8082, "escalations": { "testing": [ { "type": "console" } ] }, "keep_alive_age": "10s", "escalations_dir": "alerts/" }`) ac := config.NewDefaultConfig() err := json.Unmarshal(one, ac) if err != nil { t.Error(err) } p := NewPipeline(ac) defer p.index.Delete() ac.Policies = map[string]*alarm.Policy{"test": &alarm.Policy{}} p.Refresh(ac) }
func TestRefresh(t *testing.T) { x := runningTestContext() x.runTest(func(p *Pipeline) { p.PassEvent(event.NewEvent()) p.Refresh(config.NewDefaultConfig()) p.PassEvent(event.NewEvent()) }) }
func runningTestContext() *testContext { b := baseTestContext() b.before = func(p *Pipeline) { p.Start() conf := config.NewDefaultConfig() conf.SetProvider(config.NewMockProvider()) p.Refresh(conf) } return b }