From 83f9509aa8e56f695e06eec94990fa6725c1075e Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Tue, 12 Dec 2023 16:05:32 +0100 Subject: [PATCH] Set log level 5 for vm operator tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Büringer buringerst@vmware.com --- pkg/services/vmoperator/vmoperator_suite_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/services/vmoperator/vmoperator_suite_test.go b/pkg/services/vmoperator/vmoperator_suite_test.go index 6df4ca04b6..f6fa9630c0 100644 --- a/pkg/services/vmoperator/vmoperator_suite_test.go +++ b/pkg/services/vmoperator/vmoperator_suite_test.go @@ -24,6 +24,8 @@ import ( . "github.com/onsi/ginkgo/v2" "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" + "k8s.io/component-base/logs" + "k8s.io/klog/v2" ctrl "sigs.k8s.io/controller-runtime" ) @@ -32,6 +34,12 @@ var ctx = ctrl.SetupSignalHandler() func TestCAPVServices(t *testing.T) { RegisterFailHandler(Fail) + // Setting logger so we can set the log level to 5 to cover the code paths + // which are only executed when log level is set to >= 5. + ctrl.SetLogger(klog.Background()) + _, err := logs.GlogSetter("5") + Expect(err).ToNot(HaveOccurred()) + reporterConfig := types.NewDefaultReporterConfig() if artifactFolder, exists := os.LookupEnv("ARTIFACTS"); exists { reporterConfig.JUnitReport = filepath.Join(artifactFolder, "junit.ginkgo.pkg_services_vmoperator.xml")