From 24ec8e885929747b2056fb749950b8238723876b Mon Sep 17 00:00:00 2001 From: Rob Mulholand Date: Tue, 12 Feb 2019 11:18:39 -0600 Subject: [PATCH] Discard logs created during tests - Make sure output is being set to discard for logrus to reduce clutter in the console --- .../postgres/repositories/repositories_suite_test.go | 6 ++++++ pkg/omni/full/retriever/retriever_suite_test.go | 4 ++-- pkg/omni/full/transformer/transformer_suite_test.go | 4 ++-- pkg/omni/light/repository/repository_suite_test.go | 4 ++-- pkg/omni/light/retriever/retriever_suite_test.go | 4 ++-- pkg/omni/light/transformer/transformer_suite_test.go | 4 ++-- pkg/omni/shared/poller/poller_suite_test.go | 4 ++-- pkg/omni/shared/repository/repository_suite_test.go | 4 ++-- pkg/omni/shared/retriever/retriever_suite_test.go | 4 ++-- pkg/transformers/flop_kick/flop_kick_suite_test.go | 6 ++++++ pkg/transformers/shared/shared_suite_test.go | 6 ++++++ pkg/transformers/storage_diffs/maker/maker_suite_test.go | 6 ++++++ pkg/transformers/storage_diffs/maker/pit/pit_suite_test.go | 6 ++++++ pkg/transformers/storage_diffs/maker/vat/vat_suite_test.go | 6 ++++++ pkg/transformers/storage_diffs/shared/shared_suite_test.go | 6 ++++++ 15 files changed, 58 insertions(+), 16 deletions(-) diff --git a/pkg/datastore/postgres/repositories/repositories_suite_test.go b/pkg/datastore/postgres/repositories/repositories_suite_test.go index bf45707e0..a24b8ac07 100644 --- a/pkg/datastore/postgres/repositories/repositories_suite_test.go +++ b/pkg/datastore/postgres/repositories/repositories_suite_test.go @@ -17,6 +17,8 @@ package repositories_test import ( + "github.com/sirupsen/logrus" + "io/ioutil" "testing" . "github.com/onsi/ginkgo" @@ -27,3 +29,7 @@ func TestRepositories(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "Repositories Suite") } + +var _ = BeforeSuite(func() { + logrus.SetOutput(ioutil.Discard) +}) diff --git a/pkg/omni/full/retriever/retriever_suite_test.go b/pkg/omni/full/retriever/retriever_suite_test.go index 948f5e8eb..ba723a692 100644 --- a/pkg/omni/full/retriever/retriever_suite_test.go +++ b/pkg/omni/full/retriever/retriever_suite_test.go @@ -17,8 +17,8 @@ package retriever_test import ( + "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" @@ -31,5 +31,5 @@ func TestRetriever(t *testing.T) { } var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) + logrus.SetOutput(ioutil.Discard) }) diff --git a/pkg/omni/full/transformer/transformer_suite_test.go b/pkg/omni/full/transformer/transformer_suite_test.go index 1f362f2b3..a7eafe125 100644 --- a/pkg/omni/full/transformer/transformer_suite_test.go +++ b/pkg/omni/full/transformer/transformer_suite_test.go @@ -17,8 +17,8 @@ package transformer_test import ( + "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" @@ -31,5 +31,5 @@ func TestTransformer(t *testing.T) { } var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) + logrus.SetOutput(ioutil.Discard) }) diff --git a/pkg/omni/light/repository/repository_suite_test.go b/pkg/omni/light/repository/repository_suite_test.go index 80215953f..a38eb353b 100644 --- a/pkg/omni/light/repository/repository_suite_test.go +++ b/pkg/omni/light/repository/repository_suite_test.go @@ -17,8 +17,8 @@ package repository_test import ( + "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" @@ -31,5 +31,5 @@ func TestRepository(t *testing.T) { } var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) + logrus.SetOutput(ioutil.Discard) }) diff --git a/pkg/omni/light/retriever/retriever_suite_test.go b/pkg/omni/light/retriever/retriever_suite_test.go index cb5a73136..7494b0a9c 100644 --- a/pkg/omni/light/retriever/retriever_suite_test.go +++ b/pkg/omni/light/retriever/retriever_suite_test.go @@ -17,8 +17,8 @@ package retriever_test import ( + "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" @@ -31,5 +31,5 @@ func TestRetriever(t *testing.T) { } var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) + logrus.SetOutput(ioutil.Discard) }) diff --git a/pkg/omni/light/transformer/transformer_suite_test.go b/pkg/omni/light/transformer/transformer_suite_test.go index 52ab11974..0770d248d 100644 --- a/pkg/omni/light/transformer/transformer_suite_test.go +++ b/pkg/omni/light/transformer/transformer_suite_test.go @@ -17,8 +17,8 @@ package transformer_test import ( + "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" @@ -31,5 +31,5 @@ func TestTransformer(t *testing.T) { } var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) + logrus.SetOutput(ioutil.Discard) }) diff --git a/pkg/omni/shared/poller/poller_suite_test.go b/pkg/omni/shared/poller/poller_suite_test.go index 9a2ea8475..47bdc2f71 100644 --- a/pkg/omni/shared/poller/poller_suite_test.go +++ b/pkg/omni/shared/poller/poller_suite_test.go @@ -17,8 +17,8 @@ package poller_test import ( + "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" @@ -31,5 +31,5 @@ func TestPoller(t *testing.T) { } var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) + logrus.SetOutput(ioutil.Discard) }) diff --git a/pkg/omni/shared/repository/repository_suite_test.go b/pkg/omni/shared/repository/repository_suite_test.go index a1bfc5485..bfa6e50a2 100644 --- a/pkg/omni/shared/repository/repository_suite_test.go +++ b/pkg/omni/shared/repository/repository_suite_test.go @@ -17,8 +17,8 @@ package repository_test import ( + "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" @@ -31,5 +31,5 @@ func TestRepository(t *testing.T) { } var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) + logrus.SetOutput(ioutil.Discard) }) diff --git a/pkg/omni/shared/retriever/retriever_suite_test.go b/pkg/omni/shared/retriever/retriever_suite_test.go index b46c31fd8..f9b78611d 100644 --- a/pkg/omni/shared/retriever/retriever_suite_test.go +++ b/pkg/omni/shared/retriever/retriever_suite_test.go @@ -17,8 +17,8 @@ package retriever_test import ( + "github.com/sirupsen/logrus" "io/ioutil" - "log" "testing" . "github.com/onsi/ginkgo" @@ -31,5 +31,5 @@ func TestRetriever(t *testing.T) { } var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) + logrus.SetOutput(ioutil.Discard) }) diff --git a/pkg/transformers/flop_kick/flop_kick_suite_test.go b/pkg/transformers/flop_kick/flop_kick_suite_test.go index 7f75d4f7d..e54ed14bf 100644 --- a/pkg/transformers/flop_kick/flop_kick_suite_test.go +++ b/pkg/transformers/flop_kick/flop_kick_suite_test.go @@ -1,6 +1,8 @@ package flop_kick_test import ( + "github.com/sirupsen/logrus" + "io/ioutil" "testing" . "github.com/onsi/ginkgo" @@ -11,3 +13,7 @@ func TestFlopKick(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "FlopKick Suite") } + +var _ = BeforeSuite(func() { + logrus.SetOutput(ioutil.Discard) +}) diff --git a/pkg/transformers/shared/shared_suite_test.go b/pkg/transformers/shared/shared_suite_test.go index b2c78ef2d..ff768f495 100644 --- a/pkg/transformers/shared/shared_suite_test.go +++ b/pkg/transformers/shared/shared_suite_test.go @@ -1,6 +1,8 @@ package shared_test import ( + "github.com/sirupsen/logrus" + "io/ioutil" "testing" . "github.com/onsi/ginkgo" @@ -11,3 +13,7 @@ func TestShared(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "Shared Suite") } + +var _ = BeforeSuite(func() { + logrus.SetOutput(ioutil.Discard) +}) diff --git a/pkg/transformers/storage_diffs/maker/maker_suite_test.go b/pkg/transformers/storage_diffs/maker/maker_suite_test.go index 601507b94..e0a3151c8 100644 --- a/pkg/transformers/storage_diffs/maker/maker_suite_test.go +++ b/pkg/transformers/storage_diffs/maker/maker_suite_test.go @@ -17,6 +17,8 @@ package maker_test import ( + "github.com/sirupsen/logrus" + "io/ioutil" "testing" . "github.com/onsi/ginkgo" @@ -27,3 +29,7 @@ func TestMaker(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "Maker Suite") } + +var _ = BeforeSuite(func() { + logrus.SetOutput(ioutil.Discard) +}) diff --git a/pkg/transformers/storage_diffs/maker/pit/pit_suite_test.go b/pkg/transformers/storage_diffs/maker/pit/pit_suite_test.go index 2f78139fe..7a8fc1653 100644 --- a/pkg/transformers/storage_diffs/maker/pit/pit_suite_test.go +++ b/pkg/transformers/storage_diffs/maker/pit/pit_suite_test.go @@ -1,6 +1,8 @@ package pit_test import ( + "github.com/sirupsen/logrus" + "io/ioutil" "testing" . "github.com/onsi/ginkgo" @@ -11,3 +13,7 @@ func TestPit(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "Pit Suite") } + +var _ = BeforeSuite(func() { + logrus.SetOutput(ioutil.Discard) +}) diff --git a/pkg/transformers/storage_diffs/maker/vat/vat_suite_test.go b/pkg/transformers/storage_diffs/maker/vat/vat_suite_test.go index 89b079a06..d385774e9 100644 --- a/pkg/transformers/storage_diffs/maker/vat/vat_suite_test.go +++ b/pkg/transformers/storage_diffs/maker/vat/vat_suite_test.go @@ -1,6 +1,8 @@ package vat_test import ( + "github.com/sirupsen/logrus" + "io/ioutil" "testing" . "github.com/onsi/ginkgo" @@ -11,3 +13,7 @@ func TestVat(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "Vat Suite") } + +var _ = BeforeSuite(func() { + logrus.SetOutput(ioutil.Discard) +}) diff --git a/pkg/transformers/storage_diffs/shared/shared_suite_test.go b/pkg/transformers/storage_diffs/shared/shared_suite_test.go index a36f747f8..865d81589 100644 --- a/pkg/transformers/storage_diffs/shared/shared_suite_test.go +++ b/pkg/transformers/storage_diffs/shared/shared_suite_test.go @@ -17,6 +17,8 @@ package shared_test import ( + "github.com/sirupsen/logrus" + "io/ioutil" "testing" . "github.com/onsi/ginkgo" @@ -27,3 +29,7 @@ func TestShared(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "Shared Suite") } + +var _ = BeforeSuite(func() { + logrus.SetOutput(ioutil.Discard) +})