Skip to content

Commit

Permalink
Accept -v/--verbose option and include the usual reporter
Browse files Browse the repository at this point in the history
By default ci-queue overwrites the reporters array.

Minitest's verbose option is only utilized by it's own default reporter
and the default reporter that minitest-reporters replaces it with,
so the simplest thing to do is to simply include one of those.
  • Loading branch information
rwstauner committed Jun 13, 2023
1 parent ed18d9e commit 7754f53
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ruby/lib/minitest/queue/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,10 @@ def parser
queue.config.redis_ttl = time
end

opts.on("-v", "--verbose", "Verbose. Show progress processing files.") do
(Minitest::Reporters.reporters ||= []) << Minitest::Reporters::DefaultReporter.new(verbose: true)
end

opts.separator ""
opts.separator " retry: Replays a previous run in the same order."

Expand Down
25 changes: 25 additions & 0 deletions ruby/test/integration/minitest_redis_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,31 @@ def setup
@exe = File.expand_path('../../../exe/minitest-queue', __FILE__)
end

def test_verbose_reporter
out, err = capture_subprocess_io do
system(
{ 'BUILDKITE' => '1' },
@exe, 'run',
'--queue', @redis_url,
'--seed', 'foobar',
'--build', '1',
'--worker', '1',
'--timeout', '1',
'--max-requeues', '1',
'--requeue-tolerance', '1',
'-Itest',
'test/dummy_test.rb',
'-v',
chdir: 'test/fixtures/',
)
end

assert_empty err
output = normalize(out.lines.last.strip)
assert_match %r{ATest#test_foo \d+\.\d+ = S}, out # verbose test ouptut
assert_equal '--- Ran 11 tests, 8 assertions, 2 failures, 1 errors, 1 skips, 4 requeues in X.XXs', output
end

def test_buildkite_output
out, err = capture_subprocess_io do
system(
Expand Down

0 comments on commit 7754f53

Please sign in to comment.