Skip to content

Commit

Permalink
Merge pull request #199 from Shopify/cbruckmayer/abort-on-too-many-fa…
Browse files Browse the repository at this point in the history
…ilures

Abort when too many test failed
  • Loading branch information
ChrisBr committed Mar 15, 2023
2 parents 5454b44 + d09e4f5 commit a1efa1b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ruby/lib/minitest/queue/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def report_command
msg = "#{supervisor.size} tests weren't run."
if supervisor.max_test_failed?
puts('Encountered too many failed tests. Test run was ended early.')
puts(msg)
abort!(msg)
else
abort!(msg)
end
Expand Down
4 changes: 3 additions & 1 deletion ruby/test/integration/minitest_redis_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def test_max_test_failed
assert_equal 'Ran 47 tests, 47 assertions, 3 failures, 0 errors, 0 skips, 44 requeues in X.XXs', output

# Run the reporter
exit_code = nil
out, err = capture_subprocess_io do
system(
@exe, 'report',
Expand All @@ -102,12 +103,13 @@ def test_max_test_failed
chdir: 'test/fixtures/',
)
end

refute_predicate $?, :success?
assert_empty err
expected = <<~EXPECTED
Waiting for workers to complete
Encountered too many failed tests. Test run was ended early.
97 tests weren't run.
Ran 3 tests, 47 assertions, 3 failures, 0 errors, 0 skips, 44 requeues in X.XXs (aggregated)
EXPECTED
assert_equal expected.strip, normalize(out.lines[0..4].join.strip)
end
Expand Down

0 comments on commit a1efa1b

Please sign in to comment.