Skip to content

Commit

Permalink
Fixing slog.Logger.Error arg err should be a string or a slog.Attr (p…
Browse files Browse the repository at this point in the history
…ossible missing key or value)
  • Loading branch information
ederign committed Nov 6, 2024
1 parent ca249a0 commit febb8a0
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions clients/ui/bff/internal/mocks/k8s_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package mocks
import (
"context"
"fmt"
k8s "github.com/kubeflow/model-registry/ui/bff/internal/integrations"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/scheme"
"log/slog"
"os"
"path/filepath"
"runtime"

k8s "github.com/kubeflow/model-registry/ui/bff/internal/integrations"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/scheme"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
)
Expand Down Expand Up @@ -50,21 +51,21 @@ func NewKubernetesClient(logger *slog.Logger, ctx context.Context, cancel contex
}
cfg, err := testEnv.Start()
if err != nil {
logger.Error("failed to start test environment", err)
logger.Error("failed to start test environment", slog.String("error", err.Error()))
cancel()
os.Exit(1)
}

mockK8sClient, err := client.New(cfg, client.Options{Scheme: scheme.Scheme})
if err != nil {
logger.Error("failed to create Kubernetes client", err)
logger.Error("failed to create Kubernetes client", slog.String("error", err.Error()))
cancel()
os.Exit(1)
}

err = setupMock(mockK8sClient, ctx)
if err != nil {
logger.Error("failed on mock setup", err)
logger.Error("failed on mock setup", slog.String("error", err.Error()))
cancel()
os.Exit(1)
}
Expand Down

0 comments on commit febb8a0

Please sign in to comment.