Skip to content

Commit d09e4f5

Browse files
committed
Abort when too many test failed
We should not assume the reporter will report a non 0 exit code as all tests could be retried.
1 parent 5454b44 commit d09e4f5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

ruby/lib/minitest/queue/runner.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def report_command
199199
msg = "#{supervisor.size} tests weren't run."
200200
if supervisor.max_test_failed?
201201
puts('Encountered too many failed tests. Test run was ended early.')
202-
puts(msg)
202+
abort!(msg)
203203
else
204204
abort!(msg)
205205
end

ruby/test/integration/minitest_redis_test.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def test_max_test_failed
9191
assert_equal 'Ran 47 tests, 47 assertions, 3 failures, 0 errors, 0 skips, 44 requeues in X.XXs', output
9292

9393
# Run the reporter
94+
exit_code = nil
9495
out, err = capture_subprocess_io do
9596
system(
9697
@exe, 'report',
@@ -102,12 +103,13 @@ def test_max_test_failed
102103
chdir: 'test/fixtures/',
103104
)
104105
end
106+
107+
refute_predicate $?, :success?
105108
assert_empty err
106109
expected = <<~EXPECTED
107110
Waiting for workers to complete
108111
Encountered too many failed tests. Test run was ended early.
109112
97 tests weren't run.
110-
Ran 3 tests, 47 assertions, 3 failures, 0 errors, 0 skips, 44 requeues in X.XXs (aggregated)
111113
EXPECTED
112114
assert_equal expected.strip, normalize(out.lines[0..4].join.strip)
113115
end

0 commit comments

Comments
 (0)