Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package e2e

import (
"fmt"
"time"

"github.com/onsi/ginkgo/v2"
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -581,3 +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 =====")
}
Loading