Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions ruby/lib/minitest/queue/build_status_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -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?
Expand Down
38 changes: 21 additions & 17 deletions ruby/test/integration/minitest_redis_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand All @@ -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
Expand Down
Loading