From 31a2d14e2f3bdd321cfe72eab995fe7ed179d0cb 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 {