Skip to content

Commit

Permalink
test: improve logging for flaky TestCRD test (#1347)
Browse files Browse the repository at this point in the history
This test has become increasingly flaky. Increasing the reconciler log
level should help surface more of the reconciler logs when the test
fails.
  • Loading branch information
sdowell authored Jul 30, 2024
1 parent 60ae4f9 commit fe8eb2c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions e2e/testcases/custom_resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ import (
"kpt.dev/configsync/e2e/nomostest/testpredicates"
"kpt.dev/configsync/e2e/nomostest/testwatcher"
"kpt.dev/configsync/pkg/api/configsync"
"kpt.dev/configsync/pkg/api/configsync/v1beta1"
"kpt.dev/configsync/pkg/core/k8sobjects"
"kpt.dev/configsync/pkg/kinds"
"kpt.dev/configsync/pkg/reconcilermanager"
"kpt.dev/configsync/pkg/status"
"kpt.dev/configsync/pkg/webhook/configuration"
kstatus "sigs.k8s.io/cli-utils/pkg/kstatus/status"
Expand All @@ -56,6 +58,14 @@ func TestCRDDeleteBeforeRemoveCustomResourceV1(t *testing.T) {
nt.T.Fatal(err)
}

nt.T.Log("Increase log level of reconciler to help debug failures")
rs := nomostest.RootSyncObjectV1Beta1FromRootRepo(nt, configsync.RootSyncName)
rs.Spec.SafeOverride().LogLevels = []v1beta1.ContainerLogLevelOverride{
{ContainerName: reconcilermanager.Reconciler, LogLevel: 5},
}
nt.Must(nt.KubeClient.Apply(rs))
nt.Must(nt.Watcher.WatchForCurrentStatus(kinds.RootSyncV1Beta1(), configsync.RootSyncName, configsync.ControllerNamespace))

nsObj := k8sobjects.NamespaceObject("foo")
nt.Must(nt.RootRepos[configsync.RootSyncName].Add("acme/namespaces/foo/ns.yaml", nsObj))
anvilObj := anvilCR("v1", "heavy", 10)
Expand Down

0 comments on commit fe8eb2c

Please sign in to comment.