parallel_tests 4.7.2 → 4.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Readme.md +22 -18
- data/lib/parallel_tests/cli.rb +32 -20
- data/lib/parallel_tests/cucumber/failures_logger.rb +16 -7
- data/lib/parallel_tests/rspec/runtime_logger.rb +2 -0
- data/lib/parallel_tests/tasks.rb +8 -8
- data/lib/parallel_tests/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e815835eed992c081181431f2989b1ab60ec6a0a3c95947c90aafd5db2ebcd3
|
4
|
+
data.tar.gz: 2b70b55f1d6c8fd5980bd7373cc3d2848ff895223a55f58b669d07fe1aa396e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abbcf1ba23afba1f7d0e055d37f924ba4bd3d3e77c09a4a78a725d17158bb0553daf3ca739c41035c9d3833cd0413a40e304decf05ebe00f453ed35865c90193
|
7
|
+
data.tar.gz: 4dafcef1701e3584dae080953282b52733066bdc1415fa50aa2dc67bd91f292471dd9ff32939fdef16867226ee46aa94a6272e7705371900f320b1f196e38f95
|
data/Readme.md
CHANGED
@@ -238,23 +238,23 @@ Setup for non-rails
|
|
238
238
|
|
239
239
|
Options are:
|
240
240
|
<!-- copy output from bundle exec ./bin/parallel_test -h -->
|
241
|
-
-n
|
242
|
-
-p, --pattern
|
243
|
-
--exclude-pattern
|
244
|
-
--group-by
|
241
|
+
-n PROCESSES How many processes to use, default: available CPUs
|
242
|
+
-p, --pattern PATTERN run tests matching this regex pattern
|
243
|
+
--exclude-pattern PATTERN exclude tests matching this regex pattern
|
244
|
+
--group-by TYPE group tests by:
|
245
245
|
found - order of finding files
|
246
246
|
steps - number of cucumber/spinach steps
|
247
247
|
scenarios - individual cucumber scenarios
|
248
248
|
filesize - by size of the file
|
249
249
|
runtime - info from runtime log
|
250
250
|
default - runtime when runtime log is filled otherwise filesize
|
251
|
-
-m, --multiply-processes
|
252
|
-
-s, --single
|
251
|
+
-m, --multiply-processes COUNT use given number as a multiplier of processes to run
|
252
|
+
-s, --single PATTERN Run all matching files in the same process
|
253
253
|
-i, --isolate Do not run any other tests in the group used by --single(-s)
|
254
|
-
--isolate-n
|
254
|
+
--isolate-n PROCESSES Use 'isolate' singles with number of processes, default: 1
|
255
255
|
--highest-exit-status Exit with the highest exit status provided by test run(s)
|
256
|
-
--failure-exit-code
|
257
|
-
--specify-groups
|
256
|
+
--failure-exit-code INT Specify the exit code to use when tests fail
|
257
|
+
--specify-groups SPECS Use 'specify-groups' if you want to specify multiple specs running in multiple
|
258
258
|
processes in a specific formation. Commas indicate specs in the same process,
|
259
259
|
pipes indicate specs in a new process. Cannot use with --single, --isolate, or
|
260
260
|
--isolate-n. Ex.
|
@@ -262,12 +262,13 @@ Options are:
|
|
262
262
|
Process 1 will contain 1_spec.rb and 2_spec.rb
|
263
263
|
Process 2 will contain 3_spec.rb
|
264
264
|
Process 3 will contain all other specs
|
265
|
-
--only-group
|
265
|
+
--only-group GROUP_INDEX[,GROUP_INDEX]
|
266
|
+
Only run the given group numbers.
|
266
267
|
Changes `--group-by` default to 'filesize'.
|
267
|
-
-e, --exec
|
268
|
-
-o, --test-options '
|
269
|
-
-t, --type
|
270
|
-
--suffix
|
268
|
+
-e, --exec COMMAND execute this code parallel and with ENV['TEST_ENV_NUMBER']
|
269
|
+
-o, --test-options 'OPTIONS' execute test commands with those options
|
270
|
+
-t, --type TYPE test(default) / rspec / cucumber / spinach
|
271
|
+
--suffix PATTERN override built in test file pattern (should match suffix):
|
271
272
|
'_spec.rb$' - matches rspec files
|
272
273
|
'_(test|spec).rb$' - matches test or spec files
|
273
274
|
--serialize-stdout Serialize stdout output, nothing will be written until everything is done
|
@@ -276,14 +277,15 @@ Options are:
|
|
276
277
|
--combine-stderr Combine stderr into stdout, useful in conjunction with --serialize-stdout
|
277
278
|
--non-parallel execute same commands but do not in parallel, needs --exec
|
278
279
|
--no-symlinks Do not traverse symbolic links to find test files
|
279
|
-
--ignore-tags
|
280
|
+
--ignore-tags PATTERN When counting steps ignore scenarios with tags that match this pattern
|
280
281
|
--nice execute test commands with low priority.
|
281
|
-
--runtime-log
|
282
|
-
--allowed-missing
|
282
|
+
--runtime-log PATH Location of previously recorded test runtimes
|
283
|
+
--allowed-missing COUNT Allowed percentage of missing runtimes (default = 50)
|
283
284
|
--allow-duplicates When detecting files to run, allow duplicates
|
284
|
-
--unknown-runtime
|
285
|
+
--unknown-runtime SECONDS Use given number as unknown runtime (otherwise use average time)
|
285
286
|
--first-is-1 Use "1" as TEST_ENV_NUMBER to not reuse the default test environment
|
286
287
|
--fail-fast Stop all groups when one group fails (best used with --test-options '--fail-fast' if supported
|
288
|
+
--test-file-limit LIMIT Limit to this number of files per test run by batching (for windows set to ~100 to stay below 8192 max command limit, might have bugs from reusing test-env-number and summarizing partial results)
|
287
289
|
--verbose Print debug output
|
288
290
|
--verbose-command Combines options --verbose-process-command and --verbose-rerun-command
|
289
291
|
--verbose-process-command Print the command that will be executed by each process before it begins
|
@@ -343,6 +345,7 @@ TIPS
|
|
343
345
|
- [Capybara setup](https://github.com/grosser/parallel_tests/wiki)
|
344
346
|
- [Sphinx setup](https://github.com/grosser/parallel_tests/wiki)
|
345
347
|
- [Capistrano setup](https://github.com/grosser/parallel_tests/wiki/Remotely-with-capistrano) let your tests run on a big box instead of your laptop
|
348
|
+
- Rails vs `ArgumentError: secret_key_base`: use `config.secret_key_base = Random.hex(64)`, see [rails issue](https://github.com/rails/rails/issues/53661)
|
346
349
|
|
347
350
|
Contribute your own gotchas to the [Wiki](https://github.com/grosser/parallel_tests/wiki) or even better open a PR :)
|
348
351
|
|
@@ -444,6 +447,7 @@ inspired by [pivotal labs](https://blog.pivotal.io/labs/labs/parallelize-your-rs
|
|
444
447
|
- [Josh Westbrook](https://github.com/joshwestbrook)
|
445
448
|
- [Jay Dorsey](https://github.com/jaydorsey)
|
446
449
|
- [hatsu](https://github.com/hatsu38)
|
450
|
+
- [Mark Huk](https://github.com/vimutter)
|
447
451
|
|
448
452
|
[Michael Grosser](http://grosser.it)<br/>
|
449
453
|
michael@grosser.it<br/>
|
data/lib/parallel_tests/cli.rb
CHANGED
@@ -109,8 +109,19 @@ module ParallelTests
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def run_tests(group, process_number, num_processes, options)
|
112
|
-
if
|
113
|
-
|
112
|
+
if (limit = options[:test_file_limit])
|
113
|
+
# TODO: will have some bugs with summarizing results and last process
|
114
|
+
results = group.each_slice(limit).map do |slice|
|
115
|
+
@runner.run_tests(slice, process_number, num_processes, options)
|
116
|
+
end
|
117
|
+
result = results[0]
|
118
|
+
results[1..].each do |res|
|
119
|
+
result[:stdout] = result[:stdout].to_s + res[:stdout].to_s
|
120
|
+
result[:exit_status] = [res[:exit_status], result[:exit_status]].max
|
121
|
+
# adding all files back in, not using original cmd to show what was actually run
|
122
|
+
result[:command] |= res[:command]
|
123
|
+
end
|
124
|
+
result
|
114
125
|
else
|
115
126
|
@runner.run_tests(group, process_number, num_processes, options)
|
116
127
|
end
|
@@ -194,11 +205,11 @@ module ParallelTests
|
|
194
205
|
|
195
206
|
Options are:
|
196
207
|
BANNER
|
197
|
-
opts.on("-n
|
198
|
-
opts.on("-p", "--pattern
|
199
|
-
opts.on("--exclude-pattern", "--exclude-pattern
|
208
|
+
opts.on("-n PROCESSES", Integer, "How many processes to use, default: available CPUs") { |n| options[:count] = n }
|
209
|
+
opts.on("-p", "--pattern PATTERN", "run tests matching this regex pattern") { |pattern| options[:pattern] = /#{pattern}/ }
|
210
|
+
opts.on("--exclude-pattern", "--exclude-pattern PATTERN", "exclude tests matching this regex pattern") { |pattern| options[:exclude_pattern] = /#{pattern}/ }
|
200
211
|
opts.on(
|
201
|
-
"--group-by
|
212
|
+
"--group-by TYPE",
|
202
213
|
<<~TEXT.rstrip.split("\n").join("\n#{newline_padding}")
|
203
214
|
group tests by:
|
204
215
|
found - order of finding files
|
@@ -209,11 +220,11 @@ module ParallelTests
|
|
209
220
|
default - runtime when runtime log is filled otherwise filesize
|
210
221
|
TEXT
|
211
222
|
) { |type| options[:group_by] = type.to_sym }
|
212
|
-
opts.on("-m
|
223
|
+
opts.on("-m COUNT", "--multiply-processes COUNT", Float, "use given number as a multiplier of processes to run") do |multiply|
|
213
224
|
options[:multiply] = multiply
|
214
225
|
end
|
215
226
|
|
216
|
-
opts.on("-s
|
227
|
+
opts.on("-s PATTERN", "--single PATTERN", "Run all matching files in the same process") do |pattern|
|
217
228
|
(options[:single_process] ||= []) << /#{pattern}/
|
218
229
|
end
|
219
230
|
|
@@ -222,7 +233,7 @@ module ParallelTests
|
|
222
233
|
end
|
223
234
|
|
224
235
|
opts.on(
|
225
|
-
"--isolate-n
|
236
|
+
"--isolate-n PROCESSES",
|
226
237
|
Integer,
|
227
238
|
"Use 'isolate' singles with number of processes, default: 1"
|
228
239
|
) { |n| options[:isolate_count] = n }
|
@@ -233,13 +244,13 @@ module ParallelTests
|
|
233
244
|
) { options[:highest_exit_status] = true }
|
234
245
|
|
235
246
|
opts.on(
|
236
|
-
"--failure-exit-code
|
247
|
+
"--failure-exit-code INT",
|
237
248
|
Integer,
|
238
249
|
"Specify the exit code to use when tests fail"
|
239
250
|
) { |code| options[:failure_exit_code] = code }
|
240
251
|
|
241
252
|
opts.on(
|
242
|
-
"--specify-groups
|
253
|
+
"--specify-groups SPECS",
|
243
254
|
<<~TEXT.rstrip.split("\n").join("\n#{newline_padding}")
|
244
255
|
Use 'specify-groups' if you want to specify multiple specs running in multiple
|
245
256
|
processes in a specific formation. Commas indicate specs in the same process,
|
@@ -253,7 +264,7 @@ module ParallelTests
|
|
253
264
|
) { |groups| options[:specify_groups] = groups }
|
254
265
|
|
255
266
|
opts.on(
|
256
|
-
"--only-group
|
267
|
+
"--only-group GROUP_INDEX[,GROUP_INDEX]",
|
257
268
|
Array,
|
258
269
|
<<~TEXT.rstrip.split("\n").join("\n#{newline_padding}")
|
259
270
|
Only run the given group numbers.
|
@@ -261,16 +272,16 @@ module ParallelTests
|
|
261
272
|
TEXT
|
262
273
|
) { |groups| options[:only_group] = groups.map(&:to_i) }
|
263
274
|
|
264
|
-
opts.on("-e", "--exec
|
265
|
-
opts.on("-o", "--test-options '
|
266
|
-
opts.on("-t", "--type
|
275
|
+
opts.on("-e", "--exec COMMAND", "execute this code parallel and with ENV['TEST_ENV_NUMBER']") { |arg| options[:execute] = Shellwords.shellsplit(arg) }
|
276
|
+
opts.on("-o", "--test-options 'OPTIONS'", "execute test commands with those options") { |arg| options[:test_options] = Shellwords.shellsplit(arg) }
|
277
|
+
opts.on("-t", "--type TYPE", "test(default) / rspec / cucumber / spinach") do |type|
|
267
278
|
@runner = load_runner(type)
|
268
279
|
rescue NameError, LoadError => e
|
269
280
|
puts "Runner for `#{type}` type has not been found! (#{e})"
|
270
281
|
abort
|
271
282
|
end
|
272
283
|
opts.on(
|
273
|
-
"--suffix
|
284
|
+
"--suffix PATTERN",
|
274
285
|
<<~TEXT.rstrip.split("\n").join("\n#{newline_padding}")
|
275
286
|
override built in test file pattern (should match suffix):
|
276
287
|
'_spec.rb$' - matches rspec files
|
@@ -282,14 +293,15 @@ module ParallelTests
|
|
282
293
|
opts.on("--combine-stderr", "Combine stderr into stdout, useful in conjunction with --serialize-stdout") { options[:combine_stderr] = true }
|
283
294
|
opts.on("--non-parallel", "execute same commands but do not in parallel, needs --exec") { options[:non_parallel] = true }
|
284
295
|
opts.on("--no-symlinks", "Do not traverse symbolic links to find test files") { options[:symlinks] = false }
|
285
|
-
opts.on('--ignore-tags
|
296
|
+
opts.on('--ignore-tags PATTERN', 'When counting steps ignore scenarios with tags that match this pattern') { |arg| options[:ignore_tag_pattern] = arg }
|
286
297
|
opts.on("--nice", "execute test commands with low priority.") { options[:nice] = true }
|
287
|
-
opts.on("--runtime-log
|
288
|
-
opts.on("--allowed-missing
|
298
|
+
opts.on("--runtime-log PATH", "Location of previously recorded test runtimes") { |path| options[:runtime_log] = path }
|
299
|
+
opts.on("--allowed-missing COUNT", Integer, "Allowed percentage of missing runtimes (default = 50)") { |percent| options[:allowed_missing_percent] = percent }
|
289
300
|
opts.on('--allow-duplicates', 'When detecting files to run, allow duplicates') { options[:allow_duplicates] = true }
|
290
|
-
opts.on("--unknown-runtime
|
301
|
+
opts.on("--unknown-runtime SECONDS", Float, "Use given number as unknown runtime (otherwise use average time)") { |time| options[:unknown_runtime] = time }
|
291
302
|
opts.on("--first-is-1", "Use \"1\" as TEST_ENV_NUMBER to not reuse the default test environment") { options[:first_is_1] = true }
|
292
303
|
opts.on("--fail-fast", "Stop all groups when one group fails (best used with --test-options '--fail-fast' if supported") { options[:fail_fast] = true }
|
304
|
+
opts.on("--test-file-limit LIMIT", Integer, "Limit to this number of files per test run by batching (for windows set to ~100 to stay below 8192 max command limit, might have bugs from reusing test-env-number and summarizing partial results)") { |limit| options[:test_file_limit] = limit }
|
293
305
|
opts.on("--verbose", "Print debug output") { options[:verbose] = true }
|
294
306
|
opts.on("--verbose-command", "Combines options --verbose-process-command and --verbose-rerun-command") { options.merge! verbose_process_command: true, verbose_rerun_command: true }
|
295
307
|
opts.on("--verbose-process-command", "Print the command that will be executed by each process before it begins") { options[:verbose_process_command] = true }
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'cucumber/formatter/rerun'
|
3
3
|
require 'parallel_tests/gherkin/io'
|
4
|
+
require 'cucumber/events'
|
4
5
|
|
5
6
|
module ParallelTests
|
6
7
|
module Cucumber
|
@@ -9,15 +10,23 @@ module ParallelTests
|
|
9
10
|
|
10
11
|
def initialize(config)
|
11
12
|
super
|
13
|
+
|
12
14
|
@io = prepare_io(config.out_stream)
|
13
|
-
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
# Remove handler inherited from Cucumber::Formatter::Rerun that does not
|
17
|
+
# properly join file failures
|
18
|
+
handlers = config.event_bus.instance_variable_get(:@handlers)
|
19
|
+
handlers[::Cucumber::Events::TestRunFinished.to_s].pop
|
20
|
+
|
21
|
+
# Add our own handler
|
22
|
+
config.on_event :test_run_finished do
|
23
|
+
return if @failures.empty?
|
24
|
+
|
25
|
+
lock_output do
|
26
|
+
@failures.each do |file, lines|
|
27
|
+
lines.each do |line|
|
28
|
+
@io.print "#{file}:#{line} "
|
29
|
+
end
|
21
30
|
end
|
22
31
|
end
|
23
32
|
end
|
data/lib/parallel_tests/tasks.rb
CHANGED
@@ -15,7 +15,7 @@ module ParallelTests
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def purge_before_load
|
18
|
-
if
|
18
|
+
if ActiveRecord.version > Gem::Version.new('4.2.0')
|
19
19
|
Rake::Task.task_defined?('db:purge') ? 'db:purge' : 'app:db:purge'
|
20
20
|
end
|
21
21
|
end
|
@@ -90,7 +90,7 @@ module ParallelTests
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def schema_format_based_on_rails_version
|
93
|
-
if
|
93
|
+
if active_record_7_or_greater?
|
94
94
|
ActiveRecord.schema_format
|
95
95
|
else
|
96
96
|
ActiveRecord::Base.schema_format
|
@@ -98,7 +98,7 @@ module ParallelTests
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def schema_type_based_on_rails_version
|
101
|
-
if
|
101
|
+
if active_record_61_or_greater? || schema_format_based_on_rails_version == :ruby
|
102
102
|
"schema"
|
103
103
|
else
|
104
104
|
"structure"
|
@@ -129,7 +129,7 @@ module ParallelTests
|
|
129
129
|
end
|
130
130
|
|
131
131
|
def configured_databases
|
132
|
-
return [] unless defined?(ActiveRecord) &&
|
132
|
+
return [] unless defined?(ActiveRecord) && active_record_61_or_greater?
|
133
133
|
|
134
134
|
@@configured_databases ||= ActiveRecord::Tasks::DatabaseTasks.setup_initial_database_yaml
|
135
135
|
end
|
@@ -148,12 +148,12 @@ module ParallelTests
|
|
148
148
|
|
149
149
|
private
|
150
150
|
|
151
|
-
def
|
152
|
-
|
151
|
+
def active_record_7_or_greater?
|
152
|
+
ActiveRecord.version >= Gem::Version.new('7.0')
|
153
153
|
end
|
154
154
|
|
155
|
-
def
|
156
|
-
|
155
|
+
def active_record_61_or_greater?
|
156
|
+
ActiveRecord.version >= Gem::Version.new('6.1.0')
|
157
157
|
end
|
158
158
|
end
|
159
159
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel_tests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|
@@ -69,10 +69,11 @@ licenses:
|
|
69
69
|
- MIT
|
70
70
|
metadata:
|
71
71
|
bug_tracker_uri: https://github.com/grosser/parallel_tests/issues
|
72
|
-
changelog_uri: https://github.com/grosser/parallel_tests/blob/v4.
|
73
|
-
documentation_uri: https://github.com/grosser/parallel_tests/blob/v4.
|
74
|
-
source_code_uri: https://github.com/grosser/parallel_tests/tree/v4.
|
72
|
+
changelog_uri: https://github.com/grosser/parallel_tests/blob/v4.9.1/CHANGELOG.md
|
73
|
+
documentation_uri: https://github.com/grosser/parallel_tests/blob/v4.9.1/Readme.md
|
74
|
+
source_code_uri: https://github.com/grosser/parallel_tests/tree/v4.9.1
|
75
75
|
wiki_uri: https://github.com/grosser/parallel_tests/wiki
|
76
|
+
rubygems_mfa_required: 'true'
|
76
77
|
post_install_message:
|
77
78
|
rdoc_options: []
|
78
79
|
require_paths:
|