parallel_tests 3.5.1 → 3.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.md +26 -21
- data/lib/parallel_tests.rb +8 -10
- data/lib/parallel_tests/cli.rb +33 -15
- data/lib/parallel_tests/cucumber/runner.rb +4 -0
- data/lib/parallel_tests/gherkin/runner.rb +6 -2
- data/lib/parallel_tests/rspec/runner.rb +4 -0
- data/lib/parallel_tests/spinach/runner.rb +4 -0
- data/lib/parallel_tests/tasks.rb +8 -6
- data/lib/parallel_tests/test/runner.rb +4 -0
- data/lib/parallel_tests/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bef11937f866ff4dad761906b41261246e9b5bf5bba2baa4a2c0019da0b3d42
|
4
|
+
data.tar.gz: 5241a08bd2bd0a273347fa044b12e973b5f40ab899b750e5f00364a2db1b3e72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd2d6eeb089dae8a9925d94b70de446bd9c58e9342d8602be671aea38e521577d01273d677e8b3f278c307715cf11bce4e9a661326e75a4f484de0f798f48040
|
7
|
+
data.tar.gz: a14fcbccdcca6b1870af02ad24be6a316b504a6b14f8e37678c3b81894bbd7aac9a0403e7f45b37501c35c4be7e499a509b8b14bb288b139f43853c4c861fd26
|
data/Readme.md
CHANGED
@@ -182,19 +182,24 @@ Setup for non-rails
|
|
182
182
|
|
183
183
|
gem install parallel_tests
|
184
184
|
# go to your project dir
|
185
|
-
parallel_test
|
186
|
-
parallel_rspec
|
187
|
-
parallel_cucumber
|
188
|
-
parallel_spinach
|
185
|
+
parallel_test
|
186
|
+
parallel_rspec
|
187
|
+
parallel_cucumber
|
188
|
+
parallel_spinach
|
189
189
|
|
190
|
-
- use `ENV['TEST_ENV_NUMBER']` inside your tests to select separate db/memcache/etc.
|
191
|
-
- Only run selected files & folders:
|
190
|
+
- use `ENV['TEST_ENV_NUMBER']` inside your tests to select separate db/memcache/etc. (docker compose: expose it)
|
192
191
|
|
192
|
+
- Only run a subset of files / folders:
|
193
|
+
|
193
194
|
`parallel_test test/bar test/baz/foo_text.rb`
|
194
195
|
|
195
196
|
- Pass test-options and files via `--`:
|
196
|
-
|
197
|
-
`
|
197
|
+
|
198
|
+
`parallel_rspec -- -t acceptance -f progress -- spec/foo_spec.rb spec/acceptance`
|
199
|
+
|
200
|
+
- Pass in test options, by using the -o flag (wrap everything in quotes):
|
201
|
+
|
202
|
+
`parallel_cucumber -n 2 -o '-p foo_profile --tags @only_this_tag or @only_that_tag --format summary'`
|
198
203
|
|
199
204
|
Options are:
|
200
205
|
<!-- copy output from bundle exec ./bin/parallel_test -h -->
|
@@ -202,22 +207,21 @@ Options are:
|
|
202
207
|
-p, --pattern [PATTERN] run tests matching this regex pattern
|
203
208
|
--exclude-pattern [PATTERN] exclude tests matching this regex pattern
|
204
209
|
--group-by [TYPE] group tests by:
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
210
|
+
found - order of finding files
|
211
|
+
steps - number of cucumber/spinach steps
|
212
|
+
scenarios - individual cucumber scenarios
|
213
|
+
filesize - by size of the file
|
214
|
+
runtime - info from runtime log
|
215
|
+
default - runtime when runtime log is filled otherwise filesize
|
211
216
|
-m, --multiply-processes [FLOAT] use given number as a multiplier of processes to run
|
212
217
|
-s, --single [PATTERN] Run all matching files in the same process
|
213
|
-
-i, --isolate Do not run any other tests in the group used by --single(-s)
|
214
|
-
|
215
|
-
--
|
218
|
+
-i, --isolate Do not run any other tests in the group used by --single(-s)
|
219
|
+
--isolate-n [PROCESSES] Use 'isolate' singles with number of processes, default: 1.
|
220
|
+
--highest-exit-status Exit with the highest exit status provided by test run(s)
|
216
221
|
--specify-groups [SPECS] Use 'specify-groups' if you want to specify multiple specs running in multiple
|
217
222
|
processes in a specific formation. Commas indicate specs in the same process,
|
218
|
-
pipes indicate specs in a new process.
|
223
|
+
pipes indicate specs in a new process. Cannot use with --single, --isolate, or
|
219
224
|
--isolate-n. Ex.
|
220
|
-
Ex.
|
221
225
|
$ parallel_tests -n 3 . --specify-groups '1_spec.rb,2_spec.rb|3_spec.rb'
|
222
226
|
Process 1 will contain 1_spec.rb and 2_spec.rb
|
223
227
|
Process 2 will contain 3_spec.rb
|
@@ -227,8 +231,8 @@ Options are:
|
|
227
231
|
-o, --test-options '[OPTIONS]' execute test commands with those options
|
228
232
|
-t, --type [TYPE] test(default) / rspec / cucumber / spinach
|
229
233
|
--suffix [PATTERN] override built in test file pattern (should match suffix):
|
230
|
-
|
231
|
-
|
234
|
+
'_spec.rb$' - matches rspec files
|
235
|
+
'_(test|spec).rb$' - matches test or spec files
|
232
236
|
--serialize-stdout Serialize stdout output, nothing will be written until everything is done
|
233
237
|
--prefix-output-with-test-env-number
|
234
238
|
Prefixes test env number to the output when not using --serialize-stdout
|
@@ -394,6 +398,7 @@ inspired by [pivotal labs](https://blog.pivotal.io/labs/labs/parallelize-your-rs
|
|
394
398
|
- [Nathan Broadbent](https://github.com/ndbroadbent)
|
395
399
|
- [Vikram B Kumar](https://github.com/v-kumar)
|
396
400
|
- [Joshua Pinter](https://github.com/joshuapinter)
|
401
|
+
- [Zach Dennis](https://github.com/zdennis)
|
397
402
|
|
398
403
|
[Michael Grosser](http://grosser.it)<br/>
|
399
404
|
michael@grosser.it<br/>
|
data/lib/parallel_tests.rb
CHANGED
@@ -23,16 +23,14 @@ module ParallelTests
|
|
23
23
|
|
24
24
|
def with_pid_file
|
25
25
|
Tempfile.open('parallel_tests-pidfile') do |f|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
@pids = nil
|
35
|
-
end
|
26
|
+
ENV['PARALLEL_PID_FILE'] = f.path
|
27
|
+
# Pids object should be created before threads will start adding pids to it
|
28
|
+
# Otherwise we would have to use Mutex to prevent creation of several instances
|
29
|
+
@pids = pids
|
30
|
+
yield
|
31
|
+
ensure
|
32
|
+
ENV['PARALLEL_PID_FILE'] = nil
|
33
|
+
@pids = nil
|
36
34
|
end
|
37
35
|
end
|
38
36
|
|
data/lib/parallel_tests/cli.rb
CHANGED
@@ -84,7 +84,18 @@ module ParallelTests
|
|
84
84
|
report_time_taken(&run_tests_proc)
|
85
85
|
end
|
86
86
|
|
87
|
-
|
87
|
+
if any_test_failed?(test_results)
|
88
|
+
warn final_fail_message
|
89
|
+
|
90
|
+
# return the highest exit status to allow sub-processes to send things other than 1
|
91
|
+
exit_status = if options[:highest_exit_status]
|
92
|
+
test_results.map { |data| data.fetch(:exit_status) }.max
|
93
|
+
else
|
94
|
+
1
|
95
|
+
end
|
96
|
+
|
97
|
+
exit exit_status
|
98
|
+
end
|
88
99
|
end
|
89
100
|
|
90
101
|
def run_tests(group, process_number, num_processes, options)
|
@@ -105,13 +116,11 @@ module ParallelTests
|
|
105
116
|
|
106
117
|
def lock(lockfile)
|
107
118
|
File.open(lockfile) do |lock|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
lock.flock File::LOCK_UN
|
114
|
-
end
|
119
|
+
lock.flock File::LOCK_EX
|
120
|
+
yield
|
121
|
+
ensure
|
122
|
+
# This shouldn't be necessary, but appears to be
|
123
|
+
lock.flock File::LOCK_UN
|
115
124
|
end
|
116
125
|
end
|
117
126
|
|
@@ -209,6 +218,10 @@ module ParallelTests
|
|
209
218
|
"Use 'isolate' singles with number of processes, default: 1."
|
210
219
|
) { |n| options[:isolate_count] = n }
|
211
220
|
|
221
|
+
opts.on("--highest-exit-status", "Exit with the highest exit status provided by test run(s)") do
|
222
|
+
options[:highest_exit_status] = true
|
223
|
+
end
|
224
|
+
|
212
225
|
opts.on(
|
213
226
|
"--specify-groups [SPECS]",
|
214
227
|
<<~TEXT.rstrip.split("\n").join("\n#{newline_padding}")
|
@@ -228,12 +241,10 @@ module ParallelTests
|
|
228
241
|
opts.on("-e", "--exec [COMMAND]", "execute this code parallel and with ENV['TEST_ENV_NUMBER']") { |path| options[:execute] = path }
|
229
242
|
opts.on("-o", "--test-options '[OPTIONS]'", "execute test commands with those options") { |arg| options[:test_options] = arg.lstrip }
|
230
243
|
opts.on("-t", "--type [TYPE]", "test(default) / rspec / cucumber / spinach") do |type|
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
abort
|
236
|
-
end
|
244
|
+
@runner = load_runner(type)
|
245
|
+
rescue NameError, LoadError => e
|
246
|
+
puts "Runner for `#{type}` type has not been found! (#{e})"
|
247
|
+
abort
|
237
248
|
end
|
238
249
|
opts.on(
|
239
250
|
"--suffix [PATTERN]",
|
@@ -278,7 +289,14 @@ module ParallelTests
|
|
278
289
|
|
279
290
|
files, remaining = extract_file_paths(argv)
|
280
291
|
unless options[:execute]
|
281
|
-
|
292
|
+
if files.empty?
|
293
|
+
default_test_folder = @runner.default_test_folder
|
294
|
+
if File.directory?(default_test_folder)
|
295
|
+
files = [default_test_folder]
|
296
|
+
else
|
297
|
+
abort "Pass files or folders to run"
|
298
|
+
end
|
299
|
+
end
|
282
300
|
options[:files] = files.map { |file_path| Pathname.new(file_path).cleanpath.to_s }
|
283
301
|
end
|
284
302
|
|
@@ -24,8 +24,8 @@ module ParallelTests
|
|
24
24
|
cmd = [
|
25
25
|
executable,
|
26
26
|
(runtime_logging if File.directory?(File.dirname(runtime_log))),
|
27
|
-
|
28
|
-
|
27
|
+
*sanitized_test_files,
|
28
|
+
cucumber_opts(options[:test_options])
|
29
29
|
].compact.reject(&:empty?).join(' ')
|
30
30
|
execute_command(cmd, process_number, num_processes, options)
|
31
31
|
end
|
@@ -34,6 +34,10 @@ module ParallelTests
|
|
34
34
|
@test_file_name || 'feature'
|
35
35
|
end
|
36
36
|
|
37
|
+
def default_test_folder
|
38
|
+
'features'
|
39
|
+
end
|
40
|
+
|
37
41
|
def test_suffix
|
38
42
|
/\.feature$/
|
39
43
|
end
|
data/lib/parallel_tests/tasks.rb
CHANGED
@@ -123,12 +123,14 @@ namespace :parallel do
|
|
123
123
|
ParallelTests::Tasks.check_for_pending_migrations
|
124
124
|
if defined?(ActiveRecord::Base) && [:ruby, :sql].include?(ActiveRecord::Base.schema_format)
|
125
125
|
# fast: dump once, load in parallel
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
126
|
+
type =
|
127
|
+
if Gem::Version.new(Rails.version) >= Gem::Version.new('6.1.0')
|
128
|
+
"schema"
|
129
|
+
else
|
130
|
+
ActiveRecord::Base.schema_format == :ruby ? "schema" : "structure"
|
131
|
+
end
|
132
|
+
|
133
|
+
Rake::Task["db:#{type}:dump"].invoke
|
132
134
|
|
133
135
|
# remove database connection to prevent "database is being accessed by other users"
|
134
136
|
ActiveRecord::Base.remove_connection if ActiveRecord::Base.configurations.any?
|
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: 3.
|
4
|
+
version: 3.7.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: 2021-
|
11
|
+
date: 2021-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|
@@ -68,8 +68,8 @@ licenses:
|
|
68
68
|
- MIT
|
69
69
|
metadata:
|
70
70
|
bug_tracker_uri: https://github.com/grosser/parallel_tests/issues
|
71
|
-
documentation_uri: https://github.com/grosser/parallel_tests/blob/v3.
|
72
|
-
source_code_uri: https://github.com/grosser/parallel_tests/tree/v3.
|
71
|
+
documentation_uri: https://github.com/grosser/parallel_tests/blob/v3.7.1/Readme.md
|
72
|
+
source_code_uri: https://github.com/grosser/parallel_tests/tree/v3.7.1
|
73
73
|
wiki_uri: https://github.com/grosser/parallel_tests/wiki
|
74
74
|
post_install_message:
|
75
75
|
rdoc_options: []
|
@@ -79,14 +79,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 2.
|
82
|
+
version: 2.5.0
|
83
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
85
|
- - ">="
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '0'
|
88
88
|
requirements: []
|
89
|
-
rubygems_version: 3.
|
89
|
+
rubygems_version: 3.2.16
|
90
90
|
signing_key:
|
91
91
|
specification_version: 4
|
92
92
|
summary: Run Test::Unit / RSpec / Cucumber / Spinach in parallel
|