Skip to content

Commit 3aa1abe

Browse files
committed
Fix edge case where failures are not counted
This is a weird one. If a non-retriable and retriable test fail in the same job, and the retry either succeeds or is skipped, the non-retriable failure is lost from the count causing origin to exit 0. There was a hard assumption retries always happened, so this was an existing bug in the logic that never manifested because retries were always on in our suites. The JUnit was correct; this only affected exit counts causing the job to "pass."
1 parent 867bce8 commit 3aa1abe

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

pkg/test/ginkgo/cmd_runsuite.go

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,19 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
565565
tests = append(tests, retry)
566566
}
567567
if len(flaky) > 0 {
568-
failing = repeatFailures
568+
// Explicitly remove flakes from the failing list
569+
var withoutFlakes []*testCase
570+
flakeLoop:
571+
for _, t := range failing {
572+
for _, f := range flaky {
573+
if t.name == f {
574+
continue flakeLoop
575+
}
576+
}
577+
withoutFlakes = append(withoutFlakes, t)
578+
}
579+
failing = withoutFlakes
580+
569581
sort.Strings(flaky)
570582
fmt.Fprintf(o.Out, "Flaky tests:\n\n%s\n\n", strings.Join(flaky, "\n"))
571583
}
@@ -579,14 +591,24 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
579591
if t.name == st && t.failed {
580592
continue testLoop
581593
}
582-
withoutPreconditionFailures = append(withoutPreconditionFailures, t)
583594
}
595+
withoutPreconditionFailures = append(withoutPreconditionFailures, t)
584596
}
585597
tests = withoutPreconditionFailures
586-
failing = repeatFailures
598+
599+
var failingWithoutPreconditionFailures []*testCase
600+
failingLoop:
601+
for _, f := range failing {
602+
for _, st := range skipped {
603+
if f.name == st {
604+
continue failingLoop
605+
}
606+
}
607+
failingWithoutPreconditionFailures = append(failingWithoutPreconditionFailures, f)
608+
}
609+
failing = failingWithoutPreconditionFailures
587610
sort.Strings(skipped)
588611
fmt.Fprintf(o.Out, "Skipped tests that failed a precondition:\n\n%s\n\n", strings.Join(skipped, "\n"))
589-
590612
}
591613
}
592614

0 commit comments

Comments
 (0)