@@ -45,6 +45,7 @@ import (
4545 "sigs.k8s.io/controller-runtime/pkg/client"
4646 "sigs.k8s.io/controller-runtime/pkg/client/fake"
4747
48+ "github.com/splunk/splunk-operator/pkg/logging"
4849 splclient "github.com/splunk/splunk-operator/pkg/splunk/client"
4950 splcommon "github.com/splunk/splunk-operator/pkg/splunk/common"
5051 spltest "github.com/splunk/splunk-operator/pkg/splunk/test"
@@ -307,7 +308,7 @@ func TestGetMonitoringConsoleClient(t *testing.T) {
307308 },
308309 },
309310 }
310- scopedLog := slog .With ("func" , "TestGetMonitoringConsoleClient" , "name" , "stack1" , "namespace" , "test" )
311+ scopedLog := logging . FromContext ( context . Background ()) .With ("func" , "TestGetMonitoringConsoleClient" , "name" , "stack1" , "namespace" , "test" )
311312
312313 secrets := & corev1.Secret {
313314 ObjectMeta : metav1.ObjectMeta {
@@ -336,7 +337,7 @@ func TestGetClusterManagerClient(t *testing.T) {
336337 os .Setenv ("SPLUNK_GENERAL_TERMS" , "--accept-sgt-current-at-splunk-com" )
337338
338339 ctx := context .TODO ()
339- scopedLog := slog .With ("func" , "TestGetClusterManagerClient" , "name" , "stack1" , "namespace" , "test" )
340+ scopedLog := logging . FromContext ( ctx ) .With ("func" , "TestGetClusterManagerClient" , "name" , "stack1" , "namespace" , "test" )
340341 cr := enterpriseApi.IndexerCluster {
341342 TypeMeta : metav1.TypeMeta {
342343 Kind : "IndexerCluster" ,
@@ -387,7 +388,7 @@ func TestGetClusterManagerClient(t *testing.T) {
387388
388389func getIndexerClusterPodManager (method string , mockHandlers []spltest.MockHTTPHandler , mockSplunkClient * spltest.MockHTTPClient , replicas int32 ) * indexerClusterPodManager {
389390 os .Setenv ("SPLUNK_GENERAL_TERMS" , "--accept-sgt-current-at-splunk-com" )
390- scopedLog := slog .With ("func" , method , "name" , "stack1" , "namespace" , "test" )
391+ scopedLog := logging . FromContext ( context . Background ()) .With ("func" , method , "name" , "stack1" , "namespace" , "test" )
391392 cr := enterpriseApi.IndexerCluster {
392393 TypeMeta : metav1.TypeMeta {
393394 Kind : "IndexerCluster" ,
@@ -1029,7 +1030,7 @@ func TestSetClusterMaintenanceMode(t *testing.T) {
10291030func TestApplyIdxcSecret (t * testing.T ) {
10301031 os .Setenv ("SPLUNK_GENERAL_TERMS" , "--accept-sgt-current-at-splunk-com" )
10311032 method := "ApplyIdxcSecret"
1032- scopedLog := slog .With ("func" , method , "name" , "stack1" , "namespace" , "test" )
1033+ scopedLog := logging . FromContext ( context . Background ()) .With ("func" , method , "name" , "stack1" , "namespace" , "test" )
10331034 var initObjectList []client.Object
10341035
10351036 ctx := context .TODO ()
@@ -2830,7 +2831,7 @@ func TestPasswordSyncCompleted(t *testing.T) {
28302831 // Initialize a minimal pod manager for ApplyIdxcSecret
28312832 mgr := & indexerClusterPodManager {
28322833 c : client ,
2833- log : slog .With ("func" , "TestPasswordSyncCompleted" , "name" , idxc .GetName (), "namespace" , idxc .GetNamespace ()),
2834+ log : logging . FromContext ( ctx ) .With ("func" , "TestPasswordSyncCompleted" , "name" , idxc .GetName (), "namespace" , idxc .GetNamespace ()),
28342835 cr : & idxc ,
28352836 }
28362837
@@ -3362,7 +3363,7 @@ func TestIdxcPasswordSyncFailedEvent(t *testing.T) {
33623363
33633364 mgr := & indexerClusterPodManager {
33643365 c : c ,
3365- log : slog .With ("func" , "TestIdxcPasswordSyncFailedEvent" , "name" , idxc .GetName (), "namespace" , idxc .GetNamespace ()),
3366+ log : logging . FromContext ( ctx ) .With ("func" , "TestIdxcPasswordSyncFailedEvent" , "name" , idxc .GetName (), "namespace" , idxc .GetNamespace ()),
33663367 cr : & idxc ,
33673368 newSplunkClient : func (managementURI , username , password string ) * splclient.SplunkClient {
33683369 sc := splclient .NewSplunkClient (managementURI , username , password )
0 commit comments