Skip to content

Commit

Permalink
move log setup to init
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard87 committed Apr 30, 2024
1 parent efee6a5 commit 15d7788
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions pkg/apis/test/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down

0 comments on commit 15d7788

Please sign in to comment.