diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-02-10 11:42:24 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-02-10 12:53:46 +0300 |
commit | 37391f1d655f35df13615b3cd504be525d2927b4 (patch) | |
tree | a2ee196f6f18758818c7b66c3df60ecc0a33b6d4 | |
parent | 6c15f3295ddef8e233eb4e625f8115878bad0302 (diff) |
middleware: Silence test logger
We're setting up a new logger in our feature flag tests for the
middleware to test whether feature flags get correctly logged. This
logger is configured to print to stdout though and will thus print
messages during normal test runs.
Fix this issue by discarding all its output.
-rw-r--r-- | internal/middleware/featureflag/featureflag_handler_test.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/middleware/featureflag/featureflag_handler_test.go b/internal/middleware/featureflag/featureflag_handler_test.go index 53e033316..fbb0446c8 100644 --- a/internal/middleware/featureflag/featureflag_handler_test.go +++ b/internal/middleware/featureflag/featureflag_handler_test.go @@ -2,6 +2,7 @@ package featureflag import ( "context" + "io/ioutil" "testing" grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" @@ -72,6 +73,8 @@ func setup() (context.Context, *test.Hook) { func setupContext() (context.Context, *test.Hook) { ctx := context.Background() logger := logrus.New() + logger.SetOutput(ioutil.Discard) + hook := test.NewLocal(logger) ctx = ctxlogrus.ToContext(ctx, logrus.NewEntry(logger)) return ctx, hook |