Class: Minitest::Queue::BuildStatusReporter
- Inherits:
-
Reporters::BaseReporter
- Object
- Reporters::BaseReporter
- Minitest::Queue::BuildStatusReporter
- Includes:
- CI::Queue::OutputHelpers
- Defined in:
- lib/minitest/queue/build_status_reporter.rb
Instance Method Summary collapse
- #assertions ⇒ Object
- #completed? ⇒ Boolean
- #error_reports ⇒ Object
- #errors ⇒ Object
- #failures ⇒ Object
- #flaky_reports ⇒ Object
-
#initialize(build:, **options) ⇒ BuildStatusReporter
constructor
A new instance of BuildStatusReporter.
- #progress ⇒ Object
- #record ⇒ Object
- #report ⇒ Object
- #requeued_tests ⇒ Object
- #requeues ⇒ Object
- #skips ⇒ Object
- #success? ⇒ Boolean
- #total_time ⇒ Object
- #write_failure_file(file) ⇒ Object
- #write_flaky_tests_file(file) ⇒ Object
Constructor Details
#initialize(build:, **options) ⇒ BuildStatusReporter
Returns a new instance of BuildStatusReporter.
7 8 9 10 |
# File 'lib/minitest/queue/build_status_reporter.rb', line 7 def initialize(build:, **) @build = build super() end |
Instance Method Details
#assertions ⇒ Object
65 66 67 |
# File 'lib/minitest/queue/build_status_reporter.rb', line 65 def assertions fetch_summary['assertions'].to_i end |
#completed? ⇒ Boolean
12 13 14 |
# File 'lib/minitest/queue/build_status_reporter.rb', line 12 def completed? build.queue_exhausted? end |
#error_reports ⇒ Object
16 17 18 |
# File 'lib/minitest/queue/build_status_reporter.rb', line 16 def error_reports build.error_reports.sort_by(&:first).map { |k, v| ErrorReport.load(v) } end |
#errors ⇒ Object
61 62 63 |
# File 'lib/minitest/queue/build_status_reporter.rb', line 61 def errors fetch_summary['errors'].to_i end |
#failures ⇒ Object
57 58 59 |
# File 'lib/minitest/queue/build_status_reporter.rb', line 57 def failures fetch_summary['failures'].to_i end |
#flaky_reports ⇒ Object
20 21 22 |
# File 'lib/minitest/queue/build_status_reporter.rb', line 20 def flaky_reports build.flaky_reports end |
#progress ⇒ Object
81 82 83 |
# File 'lib/minitest/queue/build_status_reporter.rb', line 81 def progress build.progress end |
#record ⇒ Object
53 54 55 |
# File 'lib/minitest/queue/build_status_reporter.rb', line 53 def record(*) raise NotImplementedError end |
#report ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/minitest/queue/build_status_reporter.rb', line 28 def report puts aggregates 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 yellow("Worker #{worker_id } crashed") puts error puts "" end errors.empty? end |
#requeued_tests ⇒ Object
24 25 26 |
# File 'lib/minitest/queue/build_status_reporter.rb', line 24 def requeued_tests build.requeued_tests end |
#requeues ⇒ Object
73 74 75 |
# File 'lib/minitest/queue/build_status_reporter.rb', line 73 def requeues fetch_summary['requeues'].to_i end |
#skips ⇒ Object
69 70 71 |
# File 'lib/minitest/queue/build_status_reporter.rb', line 69 def skips fetch_summary['skips'].to_i end |
#success? ⇒ Boolean
48 49 50 51 |
# File 'lib/minitest/queue/build_status_reporter.rb', line 48 def success? build.error_reports.empty? && build.worker_errors.empty? end |
#total_time ⇒ Object
77 78 79 |
# File 'lib/minitest/queue/build_status_reporter.rb', line 77 def total_time fetch_summary['total_time'].to_f end |
#write_failure_file(file) ⇒ Object
85 86 87 |
# File 'lib/minitest/queue/build_status_reporter.rb', line 85 def write_failure_file(file) File.write(file, error_reports.map(&:to_h).to_json) end |
#write_flaky_tests_file(file) ⇒ Object
89 90 91 |
# File 'lib/minitest/queue/build_status_reporter.rb', line 89 def write_flaky_tests_file(file) File.write(file, flaky_reports.to_json) end |