From abc1994bec9766b3d6c8f66f90e5eddebb4a5942 Mon Sep 17 00:00:00 2001 From: Simon Pasquier Date: Tue, 23 Apr 2019 09:59:03 +0200 Subject: [PATCH] cmd/promtool: return errors from rule evaluations (#5483) Signed-off-by: Simon Pasquier --- cmd/promtool/unittest.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/promtool/unittest.go b/cmd/promtool/unittest.go index 7a67aed64..7dbf41934 100644 --- a/cmd/promtool/unittest.go +++ b/cmd/promtool/unittest.go @@ -210,6 +210,12 @@ func (tg *testGroup) test(mint, maxt time.Time, evalInterval time.Duration, grou } for _, g := range groups { g.Eval(suite.Context(), ts) + for _, r := range g.Rules() { + if r.LastError() != nil { + errs = append(errs, errors.Errorf(" rule: %s, time: %s, err: %v", + r.Name(), ts.Sub(time.Unix(0, 0)), r.LastError())) + } + } } }) if len(errs) > 0 {