Skip to content

Commit e3a9d6f

Browse files
committed
e2e: Provide more helpful error output for failing test
Tests should provide more verbose output when their core functionality fails; in this case we were only logging that the job count did not match but this is not sufficient for understanding a failure.
1 parent 0c0408c commit e3a9d6f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/e2e/apps/cronjob.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,11 @@ var _ = SIGDescribe("CronJob", func() {
269269
ginkgo.By("Ensuring a finished job exists by listing jobs explicitly")
270270
jobs, err := f.ClientSet.BatchV1().Jobs(f.Namespace.Name).List(metav1.ListOptions{})
271271
framework.ExpectNoError(err, "Failed to ensure a finished cronjob exists by listing jobs explicitly in namespace %s", f.Namespace.Name)
272-
_, finishedJobs := filterActiveJobs(jobs)
273-
framework.ExpectEqual(len(finishedJobs), 1)
272+
activeJobs, finishedJobs := filterActiveJobs(jobs)
273+
if len(finishedJobs) != 1 {
274+
framework.Logf("Expected one finished job in namespace %s; activeJobs=%v; finishedJobs=%v", f.Namespace.Name, activeJobs, finishedJobs)
275+
framework.ExpectEqual(len(finishedJobs), 1)
276+
}
274277

275278
// Job should get deleted when the next job finishes the next minute
276279
ginkgo.By("Ensuring this job and its pods does not exist anymore")

0 commit comments

Comments
 (0)