mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
Fixed TestUpdate in rules/manager_test.go (#4516)
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
This commit is contained in:
parent
f571b69010
commit
c663477688
|
@ -433,11 +433,6 @@ func TestForStateRestore(t *testing.T) {
|
||||||
newGroups := make(map[string]*Group)
|
newGroups := make(map[string]*Group)
|
||||||
newGroups["default;"] = newGroup
|
newGroups["default;"] = newGroup
|
||||||
|
|
||||||
m := NewManager(opts)
|
|
||||||
m.mtx.Lock()
|
|
||||||
m.groups = newGroups
|
|
||||||
m.mtx.Unlock()
|
|
||||||
|
|
||||||
restoreTime := baseTime.Add(tst.restoreDuration)
|
restoreTime := baseTime.Add(tst.restoreDuration)
|
||||||
// First eval before restoration.
|
// First eval before restoration.
|
||||||
newGroup.Eval(suite.Context(), restoreTime)
|
newGroup.Eval(suite.Context(), restoreTime)
|
||||||
|
@ -626,11 +621,18 @@ func TestUpdate(t *testing.T) {
|
||||||
expected := map[string]labels.Labels{
|
expected := map[string]labels.Labels{
|
||||||
"test": labels.FromStrings("name", "value"),
|
"test": labels.FromStrings("name", "value"),
|
||||||
}
|
}
|
||||||
|
storage := testutil.NewStorage(t)
|
||||||
|
defer storage.Close()
|
||||||
|
engine := promql.NewEngine(nil, nil, 10, 10*time.Second)
|
||||||
ruleManager := NewManager(&ManagerOptions{
|
ruleManager := NewManager(&ManagerOptions{
|
||||||
Context: context.Background(),
|
Appendable: storage,
|
||||||
Logger: log.NewNopLogger(),
|
TSDB: storage,
|
||||||
|
QueryFunc: EngineQueryFunc(engine, storage),
|
||||||
|
Context: context.Background(),
|
||||||
|
Logger: log.NewNopLogger(),
|
||||||
})
|
})
|
||||||
ruleManager.Run()
|
ruleManager.Run()
|
||||||
|
defer ruleManager.Stop()
|
||||||
|
|
||||||
err := ruleManager.Update(10*time.Second, files)
|
err := ruleManager.Update(10*time.Second, files)
|
||||||
testutil.Ok(t, err)
|
testutil.Ok(t, err)
|
||||||
|
|
Loading…
Reference in a new issue