Skip to content

Commit

Permalink
Fix logger warning in acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
benwh committed Dec 13, 2023
1 parent b384c1c commit aeda687
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/workloads-manager/acceptance/acceptance.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import (
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

rbacv1alpha1 "github.com/gocardless/theatre/v4/apis/rbac/v1alpha1"
workloadsv1alpha1 "github.com/gocardless/theatre/v4/apis/workloads/v1alpha1"
Expand Down Expand Up @@ -45,6 +47,10 @@ func init() {
}

func newClient(config *rest.Config) client.Client {
// Prevent the following warning from being printed to logs:
// [controller-runtime] log.SetLogger(...) was never called; logs will not be displayed.
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))

kubeClient, err := client.New(config, client.Options{Scheme: scheme})
Expect(err).NotTo(HaveOccurred(), "could not connect to kubernetes cluster")

Expand Down

0 comments on commit aeda687

Please sign in to comment.