From 716e86ef9c8191f9fbb598e4d7a3b0317cb48fea Mon Sep 17 00:00:00 2001 From: Miguel Ruiz Date: Tue, 3 Oct 2023 13:23:52 +0200 Subject: [PATCH] [bitnami/pinniped] Improve ginkgo tests debug output (#19687) * [bitnami/pinniped] Improve ginkgo tests debug output Signed-off-by: Miguel Ruiz * Add trigger Signed-off-by: Miguel Ruiz * Remove trigger Signed-off-by: Miguel Ruiz --------- Signed-off-by: Miguel Ruiz --- .vib/pinniped/ginkgo/pinniped_test.go | 34 +++++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/.vib/pinniped/ginkgo/pinniped_test.go b/.vib/pinniped/ginkgo/pinniped_test.go index 1dbaf32f1e..bb0709acf1 100644 --- a/.vib/pinniped/ginkgo/pinniped_test.go +++ b/.vib/pinniped/ginkgo/pinniped_test.go @@ -58,19 +58,17 @@ var _ = Describe("Pinniped:", func() { BeforeEach(func() { pattern := "Script finished correctly" - containsPattern, err := retry("containerLogsContainPattern", 5, 5*time.Second, func() (bool, error) { + patternFound, err := retry("containerLogsContainPattern", 5, 5*time.Second, func() (bool, error) { return containerLogsContainPattern(ctx, coreclient, testingPod.GetName(), "vib-minideb", pattern) }) if err != nil { panic(err.Error()) } - Expect(containsPattern).To(BeTrue()) - minidebPods := getPodsByLabelOrDie(ctx, coreclient, "app=vib-minideb") minidebLogs = getContainerLogsOrDie(ctx, coreclient, minidebPods.Items[0].GetName(), "vib-minideb") // Debug code left as is, given configuration complexity - if !containsPattern { + if !patternFound { fmt.Println("##### MINIDEB LOGS: #####") fmt.Println(minidebLogs) fmt.Println("###############") @@ -87,21 +85,37 @@ var _ = Describe("Pinniped:", func() { fmt.Println(supervisorLogs) fmt.Println("###############") } + Expect(patternFound).To(BeTrue()) }) It("the script was executed entirely", func() { - containsPattern, _ := containsPattern(minidebLogs, "Script finished correctly") - Expect(containsPattern).To(BeTrue()) + patternFound, _ := containsPattern(minidebLogs, "Script finished correctly") + if !patternFound { + fmt.Println("##### MINIDEB LOGS: #####") + fmt.Println(minidebLogs) + fmt.Println("###############") + } + Expect(patternFound).To(BeTrue()) }) It("the pinniped cli produced the kubeconfig", func() { - containsPattern, _ := containsPattern(minidebLogs, "connection to the cluster") - Expect(containsPattern).To(BeTrue()) + patternFound, _ := containsPattern(minidebLogs, "connection to the cluster") + if !patternFound { + fmt.Println("##### MINIDEB LOGS: #####") + fmt.Println(minidebLogs) + fmt.Println("###############") + } + Expect(patternFound).To(BeTrue()) }) It("the pinniped cli configured the cluster auth", func() { - containsPattern, _ := containsPattern(minidebLogs, "Username: "+*authUser) - Expect(containsPattern).To(BeTrue()) + patternFound, _ := containsPattern(minidebLogs, "Username: "+*authUser) + if !patternFound { + fmt.Println("##### MINIDEB LOGS: #####") + fmt.Println(minidebLogs) + fmt.Println("###############") + } + Expect(patternFound).To(BeTrue()) }) }) })