diff --git a/ruby/lib/minitest/queue/build_status_reporter.rb b/ruby/lib/minitest/queue/build_status_reporter.rb index cd947539..ea59269f 100644 --- a/ruby/lib/minitest/queue/build_status_reporter.rb +++ b/ruby/lib/minitest/queue/build_status_reporter.rb @@ -27,10 +27,19 @@ def requeued_tests end def report + if requeued_tests.to_a.any? + step("Requeued #{requeued_tests.size} tests") + requeued_tests.to_a.sort.each do |test_id, count| + puts yellow("REQUEUE") + puts "#{test_id} (requeued #{count} times)" + puts "" + end + end + puts aggregates if supervisor.time_left.to_i <= 0 - puts "Timed out waiting for tests to be executed." + puts red("Timed out waiting for tests to be executed.") remaining_tests = supervisor.test_ids remaining_tests.first(10).each do |id| @@ -40,27 +49,24 @@ def report if remaining_tests.size > 10 puts " ..." end + elsif supervisor.time_left_with_no_workers.to_i <= 0 + puts red("All workers died.") + elsif supervisor.max_test_failed? + puts red("Encountered too many failed tests. Test run was ended early.") end - puts "All workers died." if supervisor.time_left_with_no_workers.to_i <= 0 - puts 'Encountered too many failed tests. Test run was ended early.' if supervisor.max_test_failed? + puts errors = error_reports puts errors - requeued_tests.to_a.sort.each do |test_id, count| - puts yellow("REQUEUE") - puts "#{test_id} (requeued #{count} times)" - puts "" - end - build.worker_errors.to_a.sort.each do |worker_id, error| puts red("Worker #{worker_id } crashed") puts error puts "" end - errors.empty? + success? end def success? diff --git a/ruby/test/integration/minitest_redis_test.rb b/ruby/test/integration/minitest_redis_test.rb index 104cf351..59ccb769 100644 --- a/ruby/test/integration/minitest_redis_test.rb +++ b/ruby/test/integration/minitest_redis_test.rb @@ -232,13 +232,17 @@ def test_max_test_failed assert_empty err expected = <<~EXPECTED Waiting for workers to complete + Requeued 44 tests + EXPECTED + assert_equal expected.strip, normalize(out.lines[0..1].join.strip) + expected = <<~EXPECTED 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..2].join.strip) + assert_equal expected.strip, normalize(out.lines[134].strip) expected = <<~EXPECTED Encountered too many failed tests. Test run was ended early. EXPECTED - assert_equal expected.strip, normalize(out.lines[3].strip) + assert_equal expected.strip, normalize(out.lines[136].strip) expected = <<~EXPECTED 97 tests weren't run. EXPECTED @@ -916,23 +920,10 @@ def test_redis_reporter assert_empty err output = normalize(out) - expected_output = <<~END - Waiting for workers to complete - Ran 7 tests, 8 assertions, 2 failures, 1 errors, 1 skips, 4 requeues in X.XXs (aggregated) - - FAIL ATest#test_bar - Expected false to be truthy. - test/dummy_test.rb:10:in `test_bar' - - FAIL ATest#test_flaky_fails_retry - Expected false to be truthy. - test/dummy_test.rb:23:in `test_flaky_fails_retry' - - ERROR BTest#test_bar - END - assert_includes output, expected_output expected_output = <<~END + Waiting for workers to complete + Requeued 4 tests REQUEUE ATest#test_bar (requeued 1 times) @@ -944,6 +935,19 @@ def test_redis_reporter REQUEUE BTest#test_bar (requeued 1 times) + + Ran 7 tests, 8 assertions, 2 failures, 1 errors, 1 skips, 4 requeues in X.XXs (aggregated) + + + FAIL ATest#test_bar + Expected false to be truthy. + test/dummy_test.rb:10:in `test_bar' + + FAIL ATest#test_flaky_fails_retry + Expected false to be truthy. + test/dummy_test.rb:23:in `test_flaky_fails_retry' + + ERROR BTest#test_bar END assert_includes output, expected_output end