distinguish between requeued passed and requeued failed

distinguish between passed and failed requeued to remove from the
junit report. Add example_passed in the formatter registration.
This commit is contained in:
James Butters 2021-11-10 17:49:18 -07:00
parent 70942f7de7
commit baeb5c6394
2 changed files with 9 additions and 7 deletions

View File

@ -9,7 +9,8 @@ module RSpecQ
@queue = queue
@job = job
@max_requeues = max_requeues
@requeued_examples = []
@requeued_passed_examples = []
@requeued_failed_examples = []
path = path.gsub(/{{TEST_ENV_NUMBER}}/,ENV["TEST_ENV_NUMBER"].to_s)
path = path.gsub(/{{JOB_INDEX}}/, job_index.to_s)
RSpec::Support::DirectoryMaker.mkdir_p(File.dirname(path))
@ -20,30 +21,31 @@ module RSpecQ
def example_passed(notification)
# if it is a requeued run, store the notification
if !ENV["ERROR_CONTEXT_BASE_PATH"].nil?
@requeued_examples << notification.example
@requeued_passed_examples << notification.example
end
end
def example_failed(notification)
# if it is a requeued run, store the notification
if !ENV["ERROR_CONTEXT_BASE_PATH"].nil?
@requeued_examples << notification.example
@requeued_failed_examples << notification.example
end
end
private
def example_count
@summary_notification.example_count - @requeued_examples.size
@summary_notification.example_count - (@requeued_passed_examples.size + @requeued_failed_examples.size)
end
def failure_count
@summary_notification.failure_count - @requeued_examples.size
@summary_notification.failure_count - @requeued_failed_examples.size
end
def examples
ignore_examples = @requeued_failed_examples.union(@requeued_passed_examples)
@examples_notification.notifications.reject do |example_notification|
@requeued_examples.map(&:id).include?(example_notification.example.id)
ignore_examples.map(&:id).include?(example_notification.example.id)
end
end
end

View File

@ -94,7 +94,7 @@ module RSpecQ
RSpec::Core::Formatters.register(Formatters::ExampleCountRecorder, :dump_summary)
RSpec::Core::Formatters.register(Formatters::FailureRecorder, :example_failed, :message)
RSpec::Core::Formatters.register(Formatters::WorkerHeartbeatRecorder, :example_finished)
RSpec::Core::Formatters.register(Formatters::JUnitFormatter, :example_failed, :start, :stop, :dump_summary)
RSpec::Core::Formatters.register(Formatters::JUnitFormatter, :example_passed, :example_failed, :start, :stop, :dump_summary)
end
def work