From 7c16e65b4a9bcabd1939d3ff074c72aa3a9c6999 Mon Sep 17 00:00:00 2001 From: Rob Christie Date: Tue, 15 Dec 2020 11:29:12 -0700 Subject: [PATCH] Rename junit-formatter option to junit-output. --- bin/rspecq | 2 +- lib/rspecq/parser.rb | 10 ++++++---- lib/rspecq/worker.rb | 8 ++++---- test/test_e2e.rb | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/bin/rspecq b/bin/rspecq index de872ba..ce114e7 100755 --- a/bin/rspecq +++ b/bin/rspecq @@ -25,7 +25,7 @@ else worker.max_requeues = config.max_requeues worker.queue_wait_timeout = config.queue_wait_timeout worker.fail_fast = config.fail_fast - worker.junit_formatter = config.junit_formatter + worker.junit_output = config.junit_output worker.seed = config.seed if config.seed worker.reproduction = config.reproduction worker.work diff --git a/lib/rspecq/parser.rb b/lib/rspecq/parser.rb index 545b46d..416ba29 100644 --- a/lib/rspecq/parser.rb +++ b/lib/rspecq/parser.rb @@ -131,9 +131,11 @@ module RSpecQ opts[:reproduction] = v end - o.on("--junit-formatter filepath", String, "Output junit formatted xml " \ - "for CI suites to the defined file path.") do |v| - opts[:junit_formatter] = v + o.on("--junit-output filepath", String, "Output junit formatted xml " \ + "for CI suites to the defined file path. Substitution parameters " \ + "{{TEST_ENV_NUMBER}} - parallel gem proc number. " \ + "{{JOB_INDEX}} - increments with each suite that is run.") do |v| + opts[:junit_output] = v end o.on_tail("-h", "--help", "Show this message.") do @@ -162,7 +164,7 @@ module RSpecQ opts[:redis_url] ||= ENV["RSPECQ_REDIS_URL"] opts[:fail_fast] ||= Integer(ENV["RSPECQ_FAIL_FAST"] || DEFAULT_FAIL_FAST) opts[:reproduction] ||= env_set?("RSPECQ_REPRODUCTION") - opts[:junit_formatter] ||= ENV["RSPECQ_JUNIT_FORMATTER"] + opts[:junit_output] ||= ENV["RSPECQ_JUNIT_OUTPUT"] end def env_set?(var) diff --git a/lib/rspecq/worker.rb b/lib/rspecq/worker.rb index e533249..f0f58fa 100644 --- a/lib/rspecq/worker.rb +++ b/lib/rspecq/worker.rb @@ -66,7 +66,7 @@ module RSpecQ # where TEST_ENV_NUMBER is substituted with the environment variable # from the gem parallel test, and JOB_INDEX is incremented based # on the number of test suites run in the current process. - attr_accessor :junit_formatter + attr_accessor :junit_output # Optional arguments to pass along to rspec. # @@ -88,7 +88,7 @@ module RSpecQ @queue_wait_timeout = 30 @seed = srand && srand % 0xFFFF @reproduction = false - @junit_formatter = nil + @junit_output = nil RSpec::Core::Formatters.register(Formatters::JobTimingRecorder, :dump_summary) RSpec::Core::Formatters.register(Formatters::ExampleCountRecorder, :dump_summary) @@ -134,9 +134,9 @@ module RSpecQ RSpec.configuration.backtrace_formatter.filter_gem("rspecq") RSpec.configuration.add_formatter(Formatters::FailureRecorder.new(queue, job, max_requeues, @worker_id)) - if junit_formatter + if junit_output RSpec.configuration.add_formatter(Formatters::JUnitFormatter.new(queue, job, max_requeues, - idx, junit_formatter)) + idx, junit_output)) end RSpec.configuration.add_formatter(Formatters::ExampleCountRecorder.new(queue)) diff --git a/test/test_e2e.rb b/test/test_e2e.rb index e6c3f20..cef1e8e 100644 --- a/test/test_e2e.rb +++ b/test/test_e2e.rb @@ -144,9 +144,9 @@ class TestEndToEnd < RSpecQTest assert_equal 1, queue.example_count end - def test_suite_with_junit_formatter + def test_suite_with_junit_output queue = exec_build("flakey_suite", - "--junit-formatter test/test_results/test.{{JOB_INDEX}}.xml") + "--junit-output test/test_results/test.{{JOB_INDEX}}.xml") assert queue.build_successful? assert_processed_jobs [