parallel_tests 5.6.0 → 5.8.0
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/LICENSE +21 -0
- data/Readme.md +34 -38
- data/lib/parallel_tests/cli.rb +29 -12
- data/lib/parallel_tests/tasks.rb +0 -2
- data/lib/parallel_tests/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '092bd037e5c9728f7274bddb7490af927fca7c80f2504d79f23b3344da77c39b'
|
|
4
|
+
data.tar.gz: 6562747c26170da4848f852ca7ef76fbd9cff2378899f0ec1b88302de9046aa9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 81ae4c12dc1e4dbd17c3b52d7b0d7b0e46ea74f97e54a467029576f550a51ecf4ba4809c473c86a82ba2bf6325ea08cd260a9e14c64a27b0785fb6f0aa1f86d6
|
|
7
|
+
data.tar.gz: 82a9c37846b5eed1eb39f07d4fbab82b1aeb820d643f3713b080ff28d62777c4b74b9ce7ec20e187c27b111ce4c031c1c490cfad3cce854bc9c9245041e7c582
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Michael Grosser
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/Readme.md
CHANGED
|
@@ -30,40 +30,22 @@ test:
|
|
|
30
30
|
database: yourproject_test<%= ENV['TEST_ENV_NUMBER'] %>
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
### Create additional database(s)
|
|
33
|
+
### Create additional test database(s)
|
|
34
34
|
rake parallel:create
|
|
35
|
+
rake parallel:create:<database> # if using multi-db setup, <database> would be `secondary` for example
|
|
35
36
|
|
|
36
|
-
### (
|
|
37
|
-
rake parallel:create:<database>
|
|
38
|
-
rake parallel:create:secondary
|
|
39
|
-
|
|
40
|
-
### Copy development schema (repeat after migrations)
|
|
37
|
+
### Copy development schema into all test databases (repeat after migrations)
|
|
41
38
|
rake parallel:prepare
|
|
42
39
|
|
|
43
|
-
### Run migrations in additional database(s) (repeat after migrations)
|
|
44
|
-
rake parallel:migrate
|
|
45
|
-
|
|
46
|
-
### (Multi-DB) Run migrations in individual database
|
|
47
|
-
rake parallel:migrate:<database>
|
|
48
|
-
|
|
49
|
-
### Setup environment from scratch (create db and loads schema, useful for CI)
|
|
50
|
-
rake parallel:setup
|
|
51
|
-
|
|
52
|
-
### Drop all test databases
|
|
53
|
-
rake parallel:drop
|
|
54
|
-
|
|
55
|
-
### (Multi-DB) Drop individual test database
|
|
56
|
-
rake parallel:drop:<database>
|
|
57
|
-
|
|
58
40
|
### Run!
|
|
59
|
-
rake parallel:test
|
|
60
|
-
rake parallel:spec
|
|
61
|
-
rake parallel:features
|
|
62
|
-
rake parallel:features-spinach
|
|
41
|
+
rake parallel:test # Minitest
|
|
42
|
+
rake parallel:spec # RSpec
|
|
43
|
+
rake parallel:features # Cucumber
|
|
44
|
+
rake parallel:features-spinach # Spinach
|
|
63
45
|
|
|
64
46
|
rake "parallel:test[1]" --> force 1 CPU --> 86 seconds
|
|
65
|
-
rake parallel:test
|
|
66
|
-
rake parallel:test
|
|
47
|
+
rake parallel:test --> got 2 CPUs? --> 47 seconds
|
|
48
|
+
rake parallel:test --> got 4 CPUs? --> 26 seconds
|
|
67
49
|
...
|
|
68
50
|
|
|
69
51
|
Test by pattern with Regex (e.g. use one integration server per subfolder / see if you broke any 'user'-related tests)
|
|
@@ -92,6 +74,17 @@ rake "parallel:rake[my:custom:task]"
|
|
|
92
74
|
rake "parallel:rake[my:custom:task,2]"
|
|
93
75
|
```
|
|
94
76
|
|
|
77
|
+
### Run migrations in all test databases (repeat after migrations)
|
|
78
|
+
rake parallel:migrate
|
|
79
|
+
rake parallel:migrate:<database> # for multi-db setup
|
|
80
|
+
|
|
81
|
+
### Setup environment from scratch (create db and loads schema, useful for CI)
|
|
82
|
+
rake parallel:setup
|
|
83
|
+
|
|
84
|
+
### Drop all test databases
|
|
85
|
+
rake parallel:drop
|
|
86
|
+
rake parallel:drop:<database> # for multi-db setup
|
|
87
|
+
|
|
95
88
|
|
|
96
89
|
Running setup or teardown once
|
|
97
90
|
===================
|
|
@@ -144,7 +137,9 @@ Rspec: Add to your `.rspec_parallel` (or `.rspec`), but can also be used via `--
|
|
|
144
137
|
|
|
145
138
|
Add to your `test_helper.rb`:
|
|
146
139
|
```ruby
|
|
140
|
+
|
|
147
141
|
if ENV['RECORD_RUNTIME']
|
|
142
|
+
require 'minitest'
|
|
148
143
|
require 'parallel_tests/test/runtime_logger'
|
|
149
144
|
# ParallelTests::Test::RuntimeLogger.logfile = "tmp/parallel_runtime_test.log" # where to write it
|
|
150
145
|
end
|
|
@@ -262,18 +257,19 @@ Options are:
|
|
|
262
257
|
--isolate-n PROCESSES Use 'isolate' singles with number of processes, default: 1
|
|
263
258
|
--highest-exit-status Exit with the highest exit status provided by test run(s)
|
|
264
259
|
--failure-exit-code INT Specify the exit code to use when tests fail
|
|
265
|
-
--specify-groups SPECS
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
--isolate-n.
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
Process 2 will contain 3_spec.rb
|
|
273
|
-
Process 3 will contain all other specs
|
|
260
|
+
--specify-groups SPECS Specify multiple specs running in multiple processes in a given formation.
|
|
261
|
+
Commas separates specs in the same process, pipes separate processes.
|
|
262
|
+
Spec not mentioned are run in a separate process.
|
|
263
|
+
With '-' the value is read from STDIN.
|
|
264
|
+
Cannot use with --single, --isolate, or --isolate-n.
|
|
265
|
+
parallel_tests -n 3 . --specify-groups '1_spec.rb,2_spec.rb|3_spec.rb'
|
|
266
|
+
Process 1 = 1_spec.rb + 2_spec.rb, Process 2 = 3_spec.rb, Process 3 = remainder
|
|
274
267
|
--only-group GROUP_INDEX[,GROUP_INDEX]
|
|
275
|
-
Only run the given group numbers.
|
|
276
|
-
|
|
268
|
+
Only run the given group numbers. Changes `--group-by` default to 'filesize'.
|
|
269
|
+
--only-group-continuous-test-env
|
|
270
|
+
Instead of resetting `ENV['TEST_ENV_NUMBER']` when using `--only-group`, the env matches the group index`.
|
|
271
|
+
Use when running in parallel with shared resources.
|
|
272
|
+
Requires `--only-group`.
|
|
277
273
|
-e, --exec COMMAND execute COMMAND in parallel and with ENV['TEST_ENV_NUMBER']
|
|
278
274
|
--exec-args COMMAND execute COMMAND in parallel with test files as arguments, for example:
|
|
279
275
|
$ parallel_tests --exec-args echo
|
data/lib/parallel_tests/cli.rb
CHANGED
|
@@ -82,6 +82,11 @@ module ParallelTests
|
|
|
82
82
|
|
|
83
83
|
report_number_of_tests(groups) unless options[:quiet]
|
|
84
84
|
test_results = execute_in_parallel(groups, groups.size, options) do |group, index|
|
|
85
|
+
if options[:only_group] && options[:only_group_continuous_test_env]
|
|
86
|
+
# Here's where we "sync" the index. Since only_group is numerical, we need `- 1` to make it an index
|
|
87
|
+
# e.g. --only-group=1,4 should yield index 0 & 3 instead of 0 & 1
|
|
88
|
+
index = options[:only_group][index] - 1
|
|
89
|
+
end
|
|
85
90
|
run_tests(group, index, num_processes, options)
|
|
86
91
|
end
|
|
87
92
|
report_results(test_results, options) unless options[:quiet]
|
|
@@ -256,28 +261,33 @@ module ParallelTests
|
|
|
256
261
|
opts.on(
|
|
257
262
|
"--specify-groups SPECS",
|
|
258
263
|
heredoc(<<~TEXT, newline_padding)
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
--isolate-n.
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
Process 2 will contain 3_spec.rb
|
|
267
|
-
Process 3 will contain all other specs
|
|
264
|
+
Specify multiple specs running in multiple processes in a given formation.
|
|
265
|
+
Commas separates specs in the same process, pipes separate processes.
|
|
266
|
+
Spec not mentioned are run in a separate process.
|
|
267
|
+
With '-' the value is read from STDIN.
|
|
268
|
+
Cannot use with --single, --isolate, or --isolate-n.
|
|
269
|
+
parallel_tests -n 3 . --specify-groups '1_spec.rb,2_spec.rb|3_spec.rb'
|
|
270
|
+
Process 1 = 1_spec.rb + 2_spec.rb, Process 2 = 3_spec.rb, Process 3 = remainder
|
|
268
271
|
TEXT
|
|
269
272
|
) { |groups| options[:specify_groups] = groups }
|
|
270
273
|
|
|
271
274
|
opts.on(
|
|
272
275
|
"--only-group GROUP_INDEX[,GROUP_INDEX]",
|
|
273
276
|
Array,
|
|
277
|
+
"Only run the given group numbers. Changes `--group-by` default to 'filesize'."
|
|
278
|
+
) { |groups| options[:only_group] = groups.map(&:to_i) }
|
|
279
|
+
|
|
280
|
+
opts.on(
|
|
281
|
+
"--only-group-continuous-test-env",
|
|
274
282
|
heredoc(<<~TEXT, newline_padding)
|
|
275
|
-
|
|
276
|
-
|
|
283
|
+
Instead of resetting `ENV['TEST_ENV_NUMBER']` when using `--only-group`, the env matches the group index`.
|
|
284
|
+
Use when running in parallel with shared resources.
|
|
285
|
+
Requires `--only-group`.
|
|
277
286
|
TEXT
|
|
278
|
-
) {
|
|
287
|
+
) { options[:only_group_continuous_test_env] = true }
|
|
279
288
|
|
|
280
289
|
opts.on("-e", "--exec COMMAND", "execute COMMAND in parallel and with ENV['TEST_ENV_NUMBER']") { |arg| options[:execute] = Shellwords.shellsplit(arg) }
|
|
290
|
+
|
|
281
291
|
opts.on(
|
|
282
292
|
"--exec-args COMMAND",
|
|
283
293
|
heredoc(<<~TEXT, newline_padding)
|
|
@@ -334,16 +344,20 @@ module ParallelTests
|
|
|
334
344
|
opts.on("--verbose-process-command", "Print the command that will be executed by each process before it begins") { options[:verbose_process_command] = true }
|
|
335
345
|
opts.on("--verbose-rerun-command", "After a process fails, print the command executed by that process") { options[:verbose_rerun_command] = true }
|
|
336
346
|
opts.on("--quiet", "Print only tests output") { options[:quiet] = true }
|
|
347
|
+
|
|
337
348
|
opts.on("-v", "--version", "Show Version") do
|
|
338
349
|
puts ParallelTests::VERSION
|
|
339
350
|
exit 0
|
|
340
351
|
end
|
|
352
|
+
|
|
341
353
|
opts.on("-h", "--help", "Show this.") do
|
|
342
354
|
puts opts
|
|
343
355
|
exit 0
|
|
344
356
|
end
|
|
345
357
|
end.parse!(argv)
|
|
346
358
|
|
|
359
|
+
raise "--only-group is required for --only-group-continuous-test-env" if options[:only_group_continuous_test_env] && !options[:only_group]
|
|
360
|
+
|
|
347
361
|
raise "Both options are mutually exclusive: verbose & quiet" if options[:verbose] && options[:quiet]
|
|
348
362
|
|
|
349
363
|
if options[:count] == 0
|
|
@@ -375,6 +389,9 @@ module ParallelTests
|
|
|
375
389
|
if !allowed.include?(options[:group_by]) && options[:only_group]
|
|
376
390
|
raise "--group-by #{allowed.join(" or ")} is required for --only-group"
|
|
377
391
|
end
|
|
392
|
+
if options[:only_group]&.any? { |g| g <= 0 }
|
|
393
|
+
raise '--only-group should be >= 0'
|
|
394
|
+
end
|
|
378
395
|
|
|
379
396
|
if options[:specify_groups] && options.keys.intersect?([:single_process, :isolate, :isolate_count])
|
|
380
397
|
raise "Can't pass --specify-groups with any of these keys: --single, --isolate, or --isolate-n"
|
data/lib/parallel_tests/tasks.rb
CHANGED
|
@@ -203,8 +203,6 @@ namespace :parallel do
|
|
|
203
203
|
# fast: dump once, load in parallel
|
|
204
204
|
type = ParallelTests::Tasks.schema_type_based_on_rails_version
|
|
205
205
|
|
|
206
|
-
Rake::Task["db:#{type}:dump"].invoke
|
|
207
|
-
|
|
208
206
|
# remove database connection to prevent "database is being accessed by other users"
|
|
209
207
|
ActiveRecord::Base.remove_connection if ActiveRecord::Base.configurations.any?
|
|
210
208
|
|
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: 5.
|
|
4
|
+
version: 5.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael Grosser
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-09-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: parallel
|
|
@@ -34,6 +34,7 @@ executables:
|
|
|
34
34
|
extensions: []
|
|
35
35
|
extra_rdoc_files: []
|
|
36
36
|
files:
|
|
37
|
+
- LICENSE
|
|
37
38
|
- Readme.md
|
|
38
39
|
- bin/parallel_cucumber
|
|
39
40
|
- bin/parallel_rspec
|
|
@@ -69,9 +70,9 @@ licenses:
|
|
|
69
70
|
- MIT
|
|
70
71
|
metadata:
|
|
71
72
|
bug_tracker_uri: https://github.com/grosser/parallel_tests/issues
|
|
72
|
-
changelog_uri: https://github.com/grosser/parallel_tests/blob/v5.
|
|
73
|
-
documentation_uri: https://github.com/grosser/parallel_tests/blob/v5.
|
|
74
|
-
source_code_uri: https://github.com/grosser/parallel_tests/tree/v5.
|
|
73
|
+
changelog_uri: https://github.com/grosser/parallel_tests/blob/v5.8.0/CHANGELOG.md
|
|
74
|
+
documentation_uri: https://github.com/grosser/parallel_tests/blob/v5.8.0/Readme.md
|
|
75
|
+
source_code_uri: https://github.com/grosser/parallel_tests/tree/v5.8.0
|
|
75
76
|
wiki_uri: https://github.com/grosser/parallel_tests/wiki
|
|
76
77
|
rubygems_mfa_required: 'true'
|
|
77
78
|
post_install_message:
|
|
@@ -82,7 +83,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
82
83
|
requirements:
|
|
83
84
|
- - ">="
|
|
84
85
|
- !ruby/object:Gem::Version
|
|
85
|
-
version: 3.
|
|
86
|
+
version: 3.2.0
|
|
86
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
88
|
requirements:
|
|
88
89
|
- - ">="
|