From 9c69eec82aa59501698ed21f446eb61abcc489c6 Mon Sep 17 00:00:00 2001 From: Simon Pasquier Date: Fri, 3 May 2019 11:00:07 +0200 Subject: [PATCH] cmd/promtool: use log.NewNopLogger() (#5531) Signed-off-by: Simon Pasquier --- cmd/promtool/unittest.go | 9 ++------- docs/configuration/unit_testing_rules.md | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/cmd/promtool/unittest.go b/cmd/promtool/unittest.go index 295ace2d74..9d72bd39a2 100644 --- a/cmd/promtool/unittest.go +++ b/cmd/promtool/unittest.go @@ -25,6 +25,7 @@ import ( "strings" "time" + "github.com/go-kit/kit/log" "github.com/pkg/errors" yaml "gopkg.in/yaml.v2" @@ -160,7 +161,7 @@ func (tg *testGroup) test(mint, maxt time.Time, evalInterval time.Duration, grou Appendable: suite.Storage(), Context: context.Background(), NotifyFunc: func(ctx context.Context, expr string, alerts ...*rules.Alert) {}, - Logger: &dummyLogger{}, + Logger: log.NewNopLogger(), } m := rules.NewManager(opts) // TODO(beorn7): Provide a way to pass in external labels. @@ -502,9 +503,3 @@ func parsedSamplesString(pss []parsedSample) string { func (ps *parsedSample) String() string { return ps.Labels.String() + " " + strconv.FormatFloat(ps.Value, 'E', -1, 64) } - -type dummyLogger struct{} - -func (l *dummyLogger) Log(keyvals ...interface{}) error { - return nil -} diff --git a/docs/configuration/unit_testing_rules.md b/docs/configuration/unit_testing_rules.md index f767d85891..3bacc7cff6 100644 --- a/docs/configuration/unit_testing_rules.md +++ b/docs/configuration/unit_testing_rules.md @@ -25,8 +25,8 @@ rule_files: # optional, default = 1m evaluation_interval: -# The order in which group names are listed below will be the order of evaluation of -# rule groups (at a given evaluation time). The order is guaranteed only for the groups mentioned below. +# The order in which group names are listed below will be the order of evaluation of +# rule groups (at a given evaluation time). The order is guaranteed only for the groups mentioned below. # All the groups need not be mentioned below. group_eval_order: [ - ] @@ -59,13 +59,13 @@ promql_expr_test: ```yaml # This follows the usual series notation '{