Skip to content

"log.SetLogger(...) was never called" warning in controller tests #2018

@mdbooth

Description

@mdbooth

/kind bug

We frequently (always?) see this scary warning in CI out of the -test job:

[controller-runtime] log.SetLogger(...) was never called; logs will not be displayed.
Detected at:
	>  goroutine 466 [running]:
	>  runtime/debug.Stack()
	>  	/usr/local/go/src/runtime/debug/stack.go:24 +0x5e
	>  sigs.k8s.io/controller-runtime/pkg/log.eventuallyFulfillRoot()
	>  	/root/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/log/log.go:60 +0xcd
	>  sigs.k8s.io/controller-runtime/pkg/log.(*delegatingLogSink).WithValues(0xc00028b780, {0x0, 0x0, 0x0})
	>  	/root/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/log/deleg.go:168 +0x49
	>  github.com/go-logr/logr.Logger.WithValues(...)
	>  	/root/go/pkg/mod/github.com/go-logr/[email protected]/logr.go:336
	>  sigs.k8s.io/controller-runtime/pkg/log.FromContext({0x2163438?, 0x327cfc0?}, {0x0?, 0x0?, 0x0?})
	>  	/root/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/log/log.go:98 +0xf7
	>  sigs.k8s.io/cluster-api-provider-openstack/controllers.(*OpenStackClusterReconciler).Reconcile(0xc0008a25a0, {0x2163438, 0x327cfc0}, {{{0xc0006f10c0?, 0x0?}, {0xc0006f10b6?, 0x0?}}})
	>  	/home/prow/go/src/sigs.k8s.io/cluster-api-provider-openstack/controllers/openstackcluster_controller.go:75 +0xae
	>  sigs.k8s.io/cluster-api-provider-openstack/controllers.init.func1.4()
	>  	/home/prow/go/src/sigs.k8s.io/cluster-api-provider-openstack/controllers/openstackcluster_controller_test.go:178 +0x217
	>  github.com/onsi/ginkgo/v2/internal.extractBodyFunction.func3({0xc00057cfb0?, 0x91cee8?})
	>  	/root/go/pkg/mod/github.com/onsi/ginkgo/[email protected]/internal/node.go:463 +0x13
	>  github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func3()
	>  	/root/go/pkg/mod/github.com/onsi/ginkgo/[email protected]/internal/suite.go:889 +0x8d
	>  created by github.com/onsi/ginkgo/v2/internal.(*Suite).runNode in goroutine 6
	>  	/root/go/pkg/mod/github.com/onsi/ginkgo/[email protected]/internal/suite.go:876 +0xdb0

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions