Skip to content

Commit 8b0ff4f

Browse files
jhawthornabeidahmed
andcommitted
Call prerecord in test parallelization
This deviates from the vanilla minitest behaviour, which calls prerecord before tests are run even for parallel executors, which can result in interleaved output. Instead this calls prerecord after the test has come back and immediately before calling record while holding a mutex, to ensure the correct time is associated with the correct test. Co-authored-by: abeidahmed <[email protected]>
1 parent caa0b51 commit 8b0ff4f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

activesupport/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* Print test names when running `rails test -v` for parallel tests.
2+
3+
*John Hawthorn*, *Abeid Ahmed*
4+
15
* Deprecate `Benchmark.ms` core extension.
26

37
The `benchmark` gem will become bundled in Ruby 3.5

activesupport/lib/active_support/testing/parallelization/server.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
module ActiveSupport
77
module Testing
88
class Parallelization # :nodoc:
9+
PrerecordResultClass = Struct.new(:name)
10+
911
class Server
1012
include DRb::DRbUndumped
1113

@@ -21,6 +23,7 @@ def record(reporter, result)
2123
@in_flight.delete([result.klass, result.name])
2224

2325
reporter.synchronize do
26+
reporter.prerecord(PrerecordResultClass.new(result.klass), result.name)
2427
reporter.record(result)
2528
end
2629
end

0 commit comments

Comments
 (0)