Skip to content

Commit

Permalink
Merge pull request #946 from gcs278/setlogger
Browse files Browse the repository at this point in the history
OCPBUGS-14396: Set controller-runtime logger to a null logger for E2E
  • Loading branch information
openshift-merge-robot authored Jun 28, 2023
2 parents d319e46 + 8a61255 commit d0be04b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/e2e/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ import (

"github.com/aws/aws-sdk-go/aws/endpoints"

"github.com/go-logr/logr"

"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/config"
ctrlruntimelog "sigs.k8s.io/controller-runtime/pkg/log"

appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -115,6 +118,13 @@ var (
clusterConfigName = types.NamespacedName{Namespace: operatorNamespace, Name: manifests.ClusterIngressConfigName}
)

func init() {
// This is required because controller-runtime expects its consumers to
// set a logger through log.SetLogger within 30 seconds of the program's
// initalization.
ctrlruntimelog.SetLogger(logr.New(ctrlruntimelog.NullLogSink{}))
}

func TestMain(m *testing.M) {
if os.Getenv("E2E_TEST_MAIN_SKIP_SETUP") == "1" {
// If we are deriving the set of tests via `go test
Expand Down

0 comments on commit d0be04b

Please sign in to comment.