From f58c6079feeb2caeba38b4e017cf9f9e0a69cd08 Mon Sep 17 00:00:00 2001 From: Sameer_yadav <159073326+Goku2099@users.noreply.github.com> Date: Sat, 28 Mar 2026 02:01:19 +0530 Subject: [PATCH 1/2] Add failure-aware debugging for Go E2E tests Signed-off-by: Sameer_yadav <159073326+Goku2099@users.noreply.github.com> --- test/e2e/e2e_test.go | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 32537bf169..5a1c4fb6bc 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -2,6 +2,7 @@ package e2e import ( "time" + "fmt" "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" @@ -51,8 +52,14 @@ var _ = ginkgo.Describe("TrainJob e2e", func() { // Delete test namespace after each test. ginkgo.AfterEach(func() { + if ginkgo.CurrentSpecReport().Failed() { + dumpDebugInfo(ns.Name) + } // Delete test namespace after each test. - gomega.Expect(k8sClient.Delete(ctx, ns)).To(gomega.Succeed()) + err := k8sClient.Delete(ctx, ns) + if err != nil { + fmt.Println("Failed to delete namespace:", err) + } }) // These tests create TrainJob that reference supported runtime without any additional changes. @@ -581,3 +588,28 @@ var _ = ginkgo.Describe("TrainJob e2e", func() { }) }) }) +func dumpDebugInfo(namespace string) { + fmt.Println("\n===== DEBUG INFO START =====") + + podList := &corev1.PodList{} + if err := k8sClient.List(ctx, podList, client.InNamespace(namespace)); err != nil { + fmt.Println("Failed to list pods:", err) + return + } + + for _, pod := range podList.Items { + fmt.Printf("\nPod: %s\n", pod.Name) + fmt.Printf("Status: %s\n", pod.Status.Phase) + fmt.Printf("Conditions: %+v\n", pod.Status.Conditions) + } + + eventList := &corev1.EventList{} + if err := k8sClient.List(ctx, eventList, client.InNamespace(namespace)); err == nil { + fmt.Println("\nEvents:") + for _, e := range eventList.Items { + fmt.Printf("%s: %s\n", e.Reason, e.Message) + } + } + + fmt.Println("===== DEBUG INFO END =====") +} From 569fb8e110dbaa42d82c306772207aea813f2b06 Mon Sep 17 00:00:00 2001 From: Sameer_yadav <159073326+Goku2099@users.noreply.github.com> Date: Sat, 28 Mar 2026 10:17:00 +0530 Subject: [PATCH 2/2] fix: apply go fmt Signed-off-by: Sameer_yadav <159073326+Goku2099@users.noreply.github.com> --- test/e2e/e2e_test.go | 49 ++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 5a1c4fb6bc..bb07d7ffd3 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -1,8 +1,8 @@ package e2e import ( - "time" "fmt" + "time" "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" @@ -588,28 +588,29 @@ var _ = ginkgo.Describe("TrainJob e2e", func() { }) }) }) + func dumpDebugInfo(namespace string) { - fmt.Println("\n===== DEBUG INFO START =====") - - podList := &corev1.PodList{} - if err := k8sClient.List(ctx, podList, client.InNamespace(namespace)); err != nil { - fmt.Println("Failed to list pods:", err) - return - } - - for _, pod := range podList.Items { - fmt.Printf("\nPod: %s\n", pod.Name) - fmt.Printf("Status: %s\n", pod.Status.Phase) - fmt.Printf("Conditions: %+v\n", pod.Status.Conditions) - } - - eventList := &corev1.EventList{} - if err := k8sClient.List(ctx, eventList, client.InNamespace(namespace)); err == nil { - fmt.Println("\nEvents:") - for _, e := range eventList.Items { - fmt.Printf("%s: %s\n", e.Reason, e.Message) - } - } - - fmt.Println("===== DEBUG INFO END =====") + fmt.Println("\n===== DEBUG INFO START =====") + + podList := &corev1.PodList{} + if err := k8sClient.List(ctx, podList, client.InNamespace(namespace)); err != nil { + fmt.Println("Failed to list pods:", err) + return + } + + for _, pod := range podList.Items { + fmt.Printf("\nPod: %s\n", pod.Name) + fmt.Printf("Status: %s\n", pod.Status.Phase) + fmt.Printf("Conditions: %+v\n", pod.Status.Conditions) + } + + eventList := &corev1.EventList{} + if err := k8sClient.List(ctx, eventList, client.InNamespace(namespace)); err == nil { + fmt.Println("\nEvents:") + for _, e := range eventList.Items { + fmt.Printf("%s: %s\n", e.Reason, e.Message) + } + } + + fmt.Println("===== DEBUG INFO END =====") }