mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: add state tracker to alerting evaluation (#32298)
* Initial commit for state tracking * basic state transition logic and tests * constructor. test and interface fixup * use new sig for sch.definitionRoutine() * test fixup * make the linter happy * more minor linting cleanup
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/state"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/schedule"
|
||||
@@ -57,8 +59,10 @@ func TestAlertingTicker(t *testing.T) {
|
||||
sched := schedule.NewScheduler(schefCfg, nil)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
st := state.NewStateTracker()
|
||||
go func() {
|
||||
err := sched.Ticker(ctx)
|
||||
err := sched.Ticker(ctx, st)
|
||||
require.NoError(t, err)
|
||||
}()
|
||||
runtime.Gosched()
|
||||
|
||||
Reference in New Issue
Block a user