From 774c878c68be81137ed6cf6ce950e77806688528 Mon Sep 17 00:00:00 2001 From: stephsachrajda Date: Tue, 17 Oct 2023 17:32:16 -0600 Subject: [PATCH] add more logging --- ruby/lib/ci/queue/redis/base.rb | 1 + ruby/lib/minitest/queue.rb | 4 ++++ ruby/lib/minitest/queue/build_status_recorder.rb | 3 +++ ruby/lib/minitest/queue/runner.rb | 5 ++--- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ruby/lib/ci/queue/redis/base.rb b/ruby/lib/ci/queue/redis/base.rb index f8bba79e..526bbeae 100644 --- a/ruby/lib/ci/queue/redis/base.rb +++ b/ruby/lib/ci/queue/redis/base.rb @@ -80,6 +80,7 @@ def queue_initializing? end def increment_test_failed + puts "---- incrementing cache test failed" redis.incr(key('test_failed_count')) end diff --git a/ruby/lib/minitest/queue.rb b/ruby/lib/minitest/queue.rb index dde1278e..3b0416df 100644 --- a/ruby/lib/minitest/queue.rb +++ b/ruby/lib/minitest/queue.rb @@ -239,13 +239,16 @@ def run_from_queue(reporter, *) result.mark_as_flaked! failed = false elsif failed + puts "---- reporting as failure in poll" queue.report_failure! else queue.report_success! end requeued = false + if failed && CI::Queue.requeueable?(result) && queue.requeue(example) + puts "---- requeable in poll" requeued = true result.requeue! reporter.record(result) @@ -256,6 +259,7 @@ def run_from_queue(reporter, *) end if !requeued && failed + puts "---- incrementing test failed in poll" queue.increment_test_failed end end diff --git a/ruby/lib/minitest/queue/build_status_recorder.rb b/ruby/lib/minitest/queue/build_status_recorder.rb index abe8911e..d89c7e44 100644 --- a/ruby/lib/minitest/queue/build_status_recorder.rb +++ b/ruby/lib/minitest/queue/build_status_recorder.rb @@ -43,13 +43,16 @@ def record(test) elsif test.skipped? self.skips += 1 elsif test.error? + puts "--- increment error in record" self.errors += 1 elsif test.failure + puts "--- increment failure in record" self.failures += 1 end stats = COUNTERS.zip(COUNTERS.map { |c| send(c) }).to_h if (test.failure || test.error?) && !test.skipped? + puts "--- recording error in record" build.record_error("#{test.klass}##{test.name}", dump(test), stats: stats) else build.record_success("#{test.klass}##{test.name}", stats: stats, skip_flaky_record: test.skipped?) diff --git a/ruby/lib/minitest/queue/runner.rb b/ruby/lib/minitest/queue/runner.rb index bd79f1ac..4d2dc2fd 100644 --- a/ruby/lib/minitest/queue/runner.rb +++ b/ruby/lib/minitest/queue/runner.rb @@ -234,10 +234,9 @@ def report_command if queue_config.failure_file reporter = BuildStatusReporter.new(build: supervisor.build) failures = reporter.error_reports.map(&:to_h).to_json - puts "----" - puts failures - puts "----" File.write(queue_config.failure_file, failures) + + reporter.report end puts('Encountered too many failed tests. Test run was ended early.')