Skip to content

Commit ca09660

Browse files
committed
test/e2e: set logger
1 parent 606604a commit ca09660

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

docs/book/src/developer/providers/migrations/v1.4-to-v1.5.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,6 @@ for Cluster API providers. For the full list of changes please see the controlle
5353
* Some wait utils in `k8s.io/apimachinery/pkg/util/wait` have been deprecated. The migration is relatively straightforward except that passing in `0`
5454
as a timeout in `wait.PollUntilContextTimeout` is treated as a timeout with 0 seconds, in `wait.PollImmediateWithContext` it is interpreted as infinity.
5555
* The fake client has been improved to handle status properly. In tests that write the CRD status, the CRDs should be added to the fake client via `WithStatusSubresource`.
56+
* Ensure that the e2e test suite is setting a logger (e.g. via `ctrl.SetLogger(klog.Background())` in `TestE2E`. Otherwise logs are not visible and controller-runtime will print a warning.
5657

5758
For reference, please see the [Bump to CR v0.15 PR](https://github.com/kubernetes-sigs/cluster-api/pull/8007) in core Cluster API.

test/e2e/e2e_suite_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
. "github.com/onsi/gomega"
3333
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3434
"k8s.io/apimachinery/pkg/runtime"
35+
"k8s.io/klog/v2"
3536
ctrl "sigs.k8s.io/controller-runtime"
3637

3738
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
@@ -98,6 +99,8 @@ func init() {
9899
func TestE2E(t *testing.T) {
99100
g := NewWithT(t)
100101

102+
ctrl.SetLogger(klog.Background())
103+
101104
// If running in prow, make sure to use the artifacts folder that will be reported in test grid (ignoring the value provided by flag).
102105
if prowArtifactFolder, exists := os.LookupEnv("ARTIFACTS"); exists {
103106
artifactFolder = prowArtifactFolder

0 commit comments

Comments
 (0)