From 15d7788e98cb8af61aeac8f5b78f7df35956b327 Mon Sep 17 00:00:00 2001 From: Richard87 Date: Tue, 30 Apr 2024 10:13:42 +0200 Subject: [PATCH] move log setup to init --- pkg/apis/test/utils.go | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/pkg/apis/test/utils.go b/pkg/apis/test/utils.go index e32e9eab9..b42c12586 100644 --- a/pkg/apis/test/utils.go +++ b/pkg/apis/test/utils.go @@ -32,21 +32,6 @@ type Utils struct { } func init() { - SetupTestLogger() -} - -// NewTestUtils Constructor -func NewTestUtils(client kubernetes.Interface, radixclient radixclient.Interface, - secretproviderclient secretProviderClient.Interface) Utils { - kubeUtil, _ := kube.New(client, radixclient, secretproviderclient) - return Utils{ - client: client, - radixclient: radixclient, - kubeUtil: kubeUtil, - } -} - -func SetupTestLogger() { logLevelStr := os.Getenv("LOG_LEVEL") if len(logLevelStr) == 0 { logLevelStr = zerolog.LevelInfoValue @@ -63,6 +48,17 @@ func SetupTestLogger() { zerolog.DefaultContextLogger = &log.Logger } +// NewTestUtils Constructor +func NewTestUtils(client kubernetes.Interface, radixclient radixclient.Interface, + secretproviderclient secretProviderClient.Interface) Utils { + kubeUtil, _ := kube.New(client, radixclient, secretproviderclient) + return Utils{ + client: client, + radixclient: radixclient, + kubeUtil: kubeUtil, + } +} + func (tu *Utils) GetKubeUtil() *kube.Kube { return tu.kubeUtil }