From 4584d05eff22729b498ae3dc14ca4397cd1ffb06 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 14 Feb 2025 11:57:52 +0100 Subject: [PATCH] cloudapi: silence logrus in tests This commit discards the logrus output when the tests are run. That might be a controversial change but the amount of redundant output that drowns the actual failures makes it very hard to work with these tests. --- internal/cloudapi/v2/v2_internal_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/cloudapi/v2/v2_internal_test.go b/internal/cloudapi/v2/v2_internal_test.go index ed0949e6c..0e3227f5c 100644 --- a/internal/cloudapi/v2/v2_internal_test.go +++ b/internal/cloudapi/v2/v2_internal_test.go @@ -1,8 +1,10 @@ package v2 import ( + "io" "testing" + "github.com/sirupsen/logrus" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -11,6 +13,13 @@ import ( "github.com/osbuild/osbuild-composer/internal/common" ) +func init() { + // logrus is creating so much output that it drowns the useful + // test output and we don't get test anything logrus related + // anyway so silence it by default + logrus.SetOutput(io.Discard) +} + func TestSplitExtension(t *testing.T) { tests := []struct { filename string