From ce06db90ad06370c4f82f7882dc23f564860baee Mon Sep 17 00:00:00 2001 From: Yu-Lin Chen Date: Sat, 21 Oct 2023 07:23:29 +0000 Subject: [PATCH] [YUNIKORN-2065] Fail logs are not reported correctly in some e2e test --- test/e2e/preemption/preemption_test.go | 12 +++++------- test/e2e/simple_preemptor/simple_preemptor_test.go | 14 +++++++------- test/e2e/user_group_limit/user_group_limit_test.go | 11 +++++------ 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/test/e2e/preemption/preemption_test.go b/test/e2e/preemption/preemption_test.go index 77fe01f84..a2e65c8c1 100644 --- a/test/e2e/preemption/preemption_test.go +++ b/test/e2e/preemption/preemption_test.go @@ -126,12 +126,6 @@ var _ = ginkgo.AfterSuite(func() { checks, err := yunikorn.GetFailedHealthChecks() Ω(err).NotTo(gomega.HaveOccurred()) Ω(checks).To(gomega.Equal(""), checks) - - testDescription := ginkgo.CurrentSpecReport() - if testDescription.Failed() { - tests.LogTestClusterInfoWrapper(testDescription.FailureMessage(), []string{ns.Name}) - tests.LogYunikornContainer(testDescription.FailureMessage()) - } ginkgo.By("Tearing down namespace: " + ns.Name) err = kClient.TearDownNamespace(ns.Name) Ω(err).NotTo(gomega.HaveOccurred()) @@ -553,7 +547,11 @@ var _ = ginkgo.Describe("Preemption", func() { }) ginkgo.AfterEach(func() { - + testDescription := ginkgo.CurrentSpecReport() + if testDescription.Failed() { + tests.LogTestClusterInfoWrapper(testDescription.FailureMessage(), []string{ns.Name}) + tests.LogYunikornContainer(testDescription.FailureMessage()) + } // Delete all sleep pods ginkgo.By("Delete all sleep pods") err := kClient.DeletePods(ns.Name) diff --git a/test/e2e/simple_preemptor/simple_preemptor_test.go b/test/e2e/simple_preemptor/simple_preemptor_test.go index 69fdef397..9c8386f80 100644 --- a/test/e2e/simple_preemptor/simple_preemptor_test.go +++ b/test/e2e/simple_preemptor/simple_preemptor_test.go @@ -96,6 +96,8 @@ var _ = ginkgo.BeforeSuite(func() { nodesToTaint = append(nodesToTaint, node.Name) } } + ginkgo.By("Worker1:" + Worker1) + ginkgo.By("Worker2:" + Worker2) ginkgo.By("Tainting some nodes..") err = kClient.TaintNodes(nodesToTaint, taintKey, "value", v1.TaintEffectNoSchedule) @@ -132,12 +134,6 @@ var _ = ginkgo.AfterSuite(func() { checks, err := yunikorn.GetFailedHealthChecks() Ω(err).NotTo(gomega.HaveOccurred()) Ω(checks).To(gomega.Equal(""), checks) - - testDescription := ginkgo.CurrentSpecReport() - if testDescription.Failed() { - tests.LogTestClusterInfoWrapper(testDescription.FailureMessage(), []string{ns.Name}) - tests.LogYunikornContainer(testDescription.FailureMessage()) - } ginkgo.By("Tearing down namespace: " + ns.Name) err = kClient.TearDownNamespace(ns.Name) Ω(err).NotTo(gomega.HaveOccurred()) @@ -219,7 +215,11 @@ var _ = ginkgo.Describe("SimplePreemptor", func() { }) ginkgo.AfterEach(func() { - + testDescription := ginkgo.CurrentSpecReport() + if testDescription.Failed() { + tests.LogTestClusterInfoWrapper(testDescription.FailureMessage(), []string{ns.Name}) + tests.LogYunikornContainer(testDescription.FailureMessage()) + } // Delete all sleep pods ginkgo.By("Delete all sleep pods") pods, err := kClient.GetPodNamesFromNS(ns.Name) diff --git a/test/e2e/user_group_limit/user_group_limit_test.go b/test/e2e/user_group_limit/user_group_limit_test.go index 4651f70ff..7803c6319 100644 --- a/test/e2e/user_group_limit/user_group_limit_test.go +++ b/test/e2e/user_group_limit/user_group_limit_test.go @@ -95,12 +95,6 @@ var _ = ginkgo.AfterSuite(func() { checks, err := yunikorn.GetFailedHealthChecks() Ω(err).NotTo(gomega.HaveOccurred()) Ω(checks).To(gomega.Equal(""), checks) - - testDescription := ginkgo.CurrentSpecReport() - if testDescription.Failed() { - tests.LogTestClusterInfoWrapper(testDescription.FailureMessage(), []string{ns.Name}) - tests.LogYunikornContainer(testDescription.FailureMessage()) - } ginkgo.By("Tearing down namespace: " + ns.Name) err = kClient.TearDownNamespace(ns.Name) Ω(err).NotTo(gomega.HaveOccurred()) @@ -368,6 +362,11 @@ var _ = ginkgo.Describe("UserGroupLimit", func() { }) ginkgo.AfterEach(func() { + testDescription := ginkgo.CurrentSpecReport() + if testDescription.Failed() { + tests.LogTestClusterInfoWrapper(testDescription.FailureMessage(), []string{ns.Name}) + tests.LogYunikornContainer(testDescription.FailureMessage()) + } // Delete all sleep pods ginkgo.By("Delete all sleep pods") err := kClient.DeletePods(ns.Name)