rspec-multiprocess_runner 1.3.1 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/Gemfile.lock +22 -22
- data/lib/rspec/multiprocess_runner/coordinator.rb +29 -7
- data/lib/rspec/multiprocess_runner/file_coordinator.rb +6 -4
- data/lib/rspec/multiprocess_runner/reporting_formatter.rb +11 -0
- data/lib/rspec/multiprocess_runner/version.rb +1 -1
- data/lib/rspec/multiprocess_runner/worker.rb +21 -5
- data/rspec-multiprocess_runner.gemspec +2 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a7a20eae3cf50ce32007e5ad3911ef435a08ef700af8834f2dd7c850bab9498
|
4
|
+
data.tar.gz: 7f667747464c2264153c7231233e2231b6a688b78b8090aa985bd8a8392e8484
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c9509227d2289e66e5a51c706f9cd9507e775d95589e98f59f45957dffd1dde142c85280a321e5b8997441efaee3e9b2c6f22c6fbb4591f7deca36dbc8eaccf
|
7
|
+
data.tar.gz: 201eeafffde0a53bb5d398da3e5e966b698af74b48ccde3d74f591830e844c530ea7ae68f381866d7831b0effecae317f19dbcdf89a1c29845f335efe12ae4db
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
# 1.4.3
|
2
|
+
|
3
|
+
* New 1.4.2 logging is less aggressive and should only show errors now
|
4
|
+
* Adds a docker container for releasing
|
5
|
+
|
6
|
+
# 1.4.2
|
7
|
+
|
8
|
+
* Add better logging for errors that occur outside of tests
|
9
|
+
* Add docker tests for all current ruby versions and more ruby versions to test in
|
10
|
+
* Fix some minor bugs that caused incorrect error codes (still failure codes)
|
11
|
+
* Fixed the error code spec file
|
12
|
+
|
13
|
+
# 1.4.1
|
14
|
+
|
15
|
+
* Fix file coordinator helpers failing due to unknown method on command line args
|
16
|
+
|
17
|
+
# 1.4.0
|
18
|
+
|
19
|
+
* Fix issue catching spec files failing outside of tests (it will now die loudly instead of passing silently).
|
20
|
+
|
21
|
+
# 1.3.3
|
22
|
+
|
23
|
+
* File output bug fix
|
24
|
+
|
1
25
|
# 1.3.1
|
2
26
|
|
3
27
|
* Or use an environment variable for summary file.
|
data/Gemfile.lock
CHANGED
@@ -1,36 +1,36 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rspec-multiprocess_runner (1.3.
|
4
|
+
rspec-multiprocess_runner (1.4.3.pre)
|
5
5
|
rspec (>= 3.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
byebug (11.
|
10
|
+
byebug (11.1.3)
|
11
11
|
coderay (1.1.2)
|
12
12
|
diff-lcs (1.3)
|
13
|
-
method_source (0.
|
14
|
-
pry (0.
|
15
|
-
coderay (~> 1.1
|
16
|
-
method_source (~>
|
17
|
-
pry-byebug (3.
|
13
|
+
method_source (1.0.0)
|
14
|
+
pry (0.13.1)
|
15
|
+
coderay (~> 1.1)
|
16
|
+
method_source (~> 1.0)
|
17
|
+
pry-byebug (3.9.0)
|
18
18
|
byebug (~> 11.0)
|
19
|
-
pry (~> 0.
|
20
|
-
rake (
|
21
|
-
rspec (3.
|
22
|
-
rspec-core (~> 3.
|
23
|
-
rspec-expectations (~> 3.
|
24
|
-
rspec-mocks (~> 3.
|
25
|
-
rspec-core (3.
|
26
|
-
rspec-support (~> 3.
|
27
|
-
rspec-expectations (3.
|
19
|
+
pry (~> 0.13.0)
|
20
|
+
rake (13.0.1)
|
21
|
+
rspec (3.9.0)
|
22
|
+
rspec-core (~> 3.9.0)
|
23
|
+
rspec-expectations (~> 3.9.0)
|
24
|
+
rspec-mocks (~> 3.9.0)
|
25
|
+
rspec-core (3.9.2)
|
26
|
+
rspec-support (~> 3.9.3)
|
27
|
+
rspec-expectations (3.9.2)
|
28
28
|
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
-
rspec-support (~> 3.
|
30
|
-
rspec-mocks (3.
|
29
|
+
rspec-support (~> 3.9.0)
|
30
|
+
rspec-mocks (3.9.1)
|
31
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
-
rspec-support (~> 3.
|
33
|
-
rspec-support (3.
|
32
|
+
rspec-support (~> 3.9.0)
|
33
|
+
rspec-support (3.9.3)
|
34
34
|
stub_env (1.0.4)
|
35
35
|
rspec (>= 2.0, < 4.0)
|
36
36
|
|
@@ -40,9 +40,9 @@ PLATFORMS
|
|
40
40
|
DEPENDENCIES
|
41
41
|
bundler (>= 1.10)
|
42
42
|
pry-byebug
|
43
|
-
rake (
|
43
|
+
rake (>= 12.3.3)
|
44
44
|
rspec-multiprocess_runner!
|
45
45
|
stub_env
|
46
46
|
|
47
47
|
BUNDLED WITH
|
48
|
-
2.
|
48
|
+
2.1.4
|
@@ -41,7 +41,7 @@ module RSpec::MultiprocessRunner
|
|
41
41
|
def exit_code
|
42
42
|
exit_code = 0
|
43
43
|
exit_code |= 1 if any_example_failed?
|
44
|
-
exit_code |= 2 if
|
44
|
+
exit_code |= 2 if failed_workers.any? || error_messages.any?
|
45
45
|
exit_code |= 4 if work_left_to_do? || @file_coordinator.missing_files.any?
|
46
46
|
exit_code
|
47
47
|
end
|
@@ -52,10 +52,10 @@ module RSpec::MultiprocessRunner
|
|
52
52
|
end_workers_in_parallel(@workers.dup, :kill_now)
|
53
53
|
else
|
54
54
|
@shutting_down = true
|
55
|
-
print "Shutting down #{pluralize(@workers.size, "worker")} …" if options
|
55
|
+
print "Shutting down #{pluralize(@workers.size, "worker")} …" if options[:print_summary]
|
56
56
|
# end_workers_in_parallel modifies @workers, so dup before sending in
|
57
57
|
end_workers_in_parallel(@workers.dup, :shutdown_now)
|
58
|
-
if options
|
58
|
+
if options[:print_summary]
|
59
59
|
puts " done"
|
60
60
|
print_summary
|
61
61
|
end
|
@@ -203,25 +203,30 @@ module RSpec::MultiprocessRunner
|
|
203
203
|
end
|
204
204
|
end
|
205
205
|
|
206
|
+
def summary_file
|
207
|
+
File.new(options.summary_filename, 'w') if (options.summary_filename)
|
208
|
+
end
|
209
|
+
|
206
210
|
def print_summary
|
207
211
|
elapsed = Time.now - @start_time
|
208
212
|
by_status_and_time = combine_example_results.each_with_object(Hash.new { |h, k| h[k] = [] }) do |result, idx|
|
209
213
|
idx[result.status] << result
|
210
214
|
end
|
211
215
|
|
212
|
-
outputs = [
|
213
|
-
outputs << File.new(options.summary_filename, 'w') if (options.summary_filename)
|
216
|
+
outputs = [$stdout, summary_file].compact
|
214
217
|
outputs.each do |output|
|
215
218
|
print_skipped_files_details(output)
|
216
219
|
print_pending_example_details(output, by_status_and_time["pending"])
|
217
220
|
print_failed_example_details(output, by_status_and_time["failed"])
|
218
221
|
print_missing_files(output)
|
219
|
-
log_failed_files(by_status_and_time["failed"].map(&:filename).uniq + @file_coordinator.missing_files.to_a) if options.log_failing_files
|
222
|
+
log_failed_files(output, by_status_and_time["failed"].map(&:filename).uniq + @file_coordinator.missing_files.to_a) if options.log_failing_files
|
220
223
|
print_failed_process_details(output)
|
224
|
+
print_error_messages(output)
|
221
225
|
output.puts
|
222
226
|
print_elapsed_time(output, elapsed)
|
223
227
|
output.puts failed? ? "FAILURE" : "SUCCESS"
|
224
228
|
print_example_counts(output, by_status_and_time)
|
229
|
+
output.close unless output == $stdout
|
225
230
|
end
|
226
231
|
end
|
227
232
|
|
@@ -229,6 +234,10 @@ module RSpec::MultiprocessRunner
|
|
229
234
|
@file_coordinator.results.select { |r| r.run_status == "example_complete" }.sort_by { |r| r.time_finished }
|
230
235
|
end
|
231
236
|
|
237
|
+
def error_messages
|
238
|
+
@file_coordinator.results.select { |r| r.run_status == "error_running" }.sort_by { |r| r.time_finished }
|
239
|
+
end
|
240
|
+
|
232
241
|
def any_example_failed?
|
233
242
|
@file_coordinator.results.detect { |r| r.status == "failed" }
|
234
243
|
end
|
@@ -263,7 +272,7 @@ module RSpec::MultiprocessRunner
|
|
263
272
|
end
|
264
273
|
end
|
265
274
|
|
266
|
-
def log_failed_files(failed_files)
|
275
|
+
def log_failed_files(output, failed_files)
|
267
276
|
return if failed_files.nil?
|
268
277
|
output.puts
|
269
278
|
output.puts "Writing failures to file: #{options.log_failing_files}"
|
@@ -286,6 +295,7 @@ module RSpec::MultiprocessRunner
|
|
286
295
|
pending_count = by_status_and_time["pending"] ? by_status_and_time["pending"].size : 0
|
287
296
|
missing_count = @file_coordinator.missing_files.size
|
288
297
|
process_failure_count = failed_workers.size
|
298
|
+
error_count = error_messages.size
|
289
299
|
skipped_count = @file_coordinator.remaining_files.size
|
290
300
|
|
291
301
|
# Copied from RSpec
|
@@ -293,6 +303,7 @@ module RSpec::MultiprocessRunner
|
|
293
303
|
summary << ", " << pluralize(failure_count, "failure")
|
294
304
|
summary << ", #{pending_count} pending" if pending_count > 0
|
295
305
|
summary << ", " << pluralize(process_failure_count, "failed proc") if process_failure_count > 0
|
306
|
+
summary << ", " << pluralize(error_count, "error") if error_count > 0
|
296
307
|
summary << ", " << pluralize(skipped_count, "skipped file") if skipped_count > 0
|
297
308
|
summary << ", " << pluralize(missing_count, "missing file") if missing_count > 0
|
298
309
|
output.puts summary
|
@@ -307,6 +318,17 @@ module RSpec::MultiprocessRunner
|
|
307
318
|
end
|
308
319
|
end
|
309
320
|
|
321
|
+
def print_error_messages(output)
|
322
|
+
return if error_messages.nil?
|
323
|
+
output.puts
|
324
|
+
output.puts "Errors:"
|
325
|
+
error_messages.each_with_index do |error, i|
|
326
|
+
output.puts
|
327
|
+
output.puts " #{i.next}) #{error.filename}"
|
328
|
+
output.print error.message
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
310
332
|
def print_missing_files(output)
|
311
333
|
return if @file_coordinator.missing_files.empty?
|
312
334
|
output.puts
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'rspec/multiprocess_runner'
|
3
3
|
require 'socket'
|
4
|
+
require 'json'
|
4
5
|
require 'set'
|
5
6
|
|
6
7
|
module RSpec::MultiprocessRunner
|
@@ -14,7 +15,7 @@ module RSpec::MultiprocessRunner
|
|
14
15
|
COMMAND_FINISHED = "finished"
|
15
16
|
COMMAND_START = "start"
|
16
17
|
|
17
|
-
def initialize(files, options=
|
18
|
+
def initialize(files, options=RSpec::MultiprocessRunner::CommandLineOptions.new)
|
18
19
|
@spec_files = []
|
19
20
|
@results = Set.new
|
20
21
|
@threads = []
|
@@ -69,7 +70,8 @@ module RSpec::MultiprocessRunner
|
|
69
70
|
else
|
70
71
|
return nil # Malformed response, assume done, cease function
|
71
72
|
end
|
72
|
-
rescue
|
73
|
+
rescue StandardError => e
|
74
|
+
puts("Got exception #{e} in get_file")
|
73
75
|
return nil # If Error, assume done, cease function
|
74
76
|
end
|
75
77
|
end
|
@@ -122,7 +124,7 @@ module RSpec::MultiprocessRunner
|
|
122
124
|
break unless raw_response
|
123
125
|
command, results, node = JSON.parse(raw_response)
|
124
126
|
if command == COMMAND_START
|
125
|
-
if results == options.
|
127
|
+
if results == options.run_identifier
|
126
128
|
socket.puts COMMAND_START
|
127
129
|
else
|
128
130
|
socket.puts COMMAND_FINISHED
|
@@ -143,7 +145,7 @@ module RSpec::MultiprocessRunner
|
|
143
145
|
|
144
146
|
def start?
|
145
147
|
begin
|
146
|
-
@node_socket.puts [COMMAND_START, options.
|
148
|
+
@node_socket.puts [COMMAND_START, options.run_identifier].to_json
|
147
149
|
response = @node_socket.gets
|
148
150
|
response = response.chomp if response
|
149
151
|
raise BadStartStringError if response == COMMAND_FINISHED
|
@@ -59,6 +59,17 @@ module RSpec::MultiprocessRunner
|
|
59
59
|
)
|
60
60
|
end
|
61
61
|
|
62
|
+
def message(struct)
|
63
|
+
# this is just for reporting errors not otherwise reported
|
64
|
+
return unless RSpec.world.non_example_failure
|
65
|
+
|
66
|
+
message = struct.message
|
67
|
+
# skip these as they always come after an error is seems
|
68
|
+
return if message =~ /^No examples found./
|
69
|
+
|
70
|
+
worker.report_error(message)
|
71
|
+
end
|
72
|
+
|
62
73
|
private
|
63
74
|
|
64
75
|
def capture_output
|
@@ -29,6 +29,7 @@ module RSpec::MultiprocessRunner
|
|
29
29
|
|
30
30
|
STATUS_EXAMPLE_COMPLETE = "example_complete"
|
31
31
|
STATUS_RUN_COMPLETE = "run_complete"
|
32
|
+
ERROR_RUNNING = "error_running"
|
32
33
|
|
33
34
|
def initialize(environment_number, options)
|
34
35
|
@environment_number = environment_number
|
@@ -196,6 +197,10 @@ module RSpec::MultiprocessRunner
|
|
196
197
|
end
|
197
198
|
$stdout.puts "#{environment_number} (#{pid}): #{message_hash["description"]} (#{location})#{suffix}"
|
198
199
|
@current_example_started_at = Time.now
|
200
|
+
when ERROR_RUNNING
|
201
|
+
example_results << Result.new(message_hash)
|
202
|
+
$stdout.puts "Error in file: #{message_hash["filename"]}"
|
203
|
+
$stdout.print message_hash["message"]
|
199
204
|
else
|
200
205
|
$stderr.puts "Received unsupported status #{message_hash["status"].inspect} in worker #{pid}"
|
201
206
|
end
|
@@ -219,7 +224,15 @@ module RSpec::MultiprocessRunner
|
|
219
224
|
description: description,
|
220
225
|
line_number: line_number,
|
221
226
|
details: details,
|
222
|
-
filename: @current_file
|
227
|
+
filename: @current_file,
|
228
|
+
)
|
229
|
+
end
|
230
|
+
|
231
|
+
def report_error(message)
|
232
|
+
send_message_to_coordinator(
|
233
|
+
status: ERROR_RUNNING,
|
234
|
+
message: message,
|
235
|
+
filename: @current_file,
|
223
236
|
)
|
224
237
|
end
|
225
238
|
|
@@ -263,9 +276,9 @@ module RSpec::MultiprocessRunner
|
|
263
276
|
def act_on_message_from_coordinator(message_hash)
|
264
277
|
return handle_closed_coordinator_socket unless message_hash # EOF
|
265
278
|
case message_hash["command"]
|
266
|
-
when
|
279
|
+
when COMMAND_QUIT
|
267
280
|
exit
|
268
|
-
when
|
281
|
+
when COMMAND_RUN_FILE
|
269
282
|
execute_spec(message_hash["filename"])
|
270
283
|
else
|
271
284
|
$stderr.puts "Received unsupported command #{message_hash["command"].inspect} in worker #{pid}"
|
@@ -281,7 +294,9 @@ module RSpec::MultiprocessRunner
|
|
281
294
|
RSpec.world.example_groups.clear
|
282
295
|
|
283
296
|
ReportingFormatter.worker = self
|
284
|
-
|
297
|
+
error_stream = StringIO.new
|
298
|
+
output_stream = StringIO.new
|
299
|
+
RSpec::Core::Runner.run(@rspec_arguments + [spec_file], error_stream, output_stream)
|
285
300
|
send_message_to_coordinator(status: STATUS_RUN_COMPLETE, filename: spec_file)
|
286
301
|
ensure
|
287
302
|
@current_file = nil
|
@@ -322,7 +337,7 @@ module RSpec::MultiprocessRunner
|
|
322
337
|
|
323
338
|
# @private
|
324
339
|
class Result
|
325
|
-
attr_reader :
|
340
|
+
attr_reader :description, :details, :filename, :message, :run_status, :status, :time_finished
|
326
341
|
|
327
342
|
def initialize(complete_message, time = Time.now)
|
328
343
|
@hash = complete_message
|
@@ -331,6 +346,7 @@ module RSpec::MultiprocessRunner
|
|
331
346
|
@description = complete_message["description"]
|
332
347
|
@details = complete_message["details"]
|
333
348
|
@filename = complete_message["filename"]
|
349
|
+
@message = complete_message["message"]
|
334
350
|
@time_finished = time
|
335
351
|
end
|
336
352
|
|
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", ">= 1.10"
|
24
24
|
spec.add_development_dependency "pry-byebug"
|
25
|
-
spec.add_development_dependency "
|
25
|
+
spec.add_development_dependency "byebug", "<11" if RUBY_VERSION.to_f < 2.4
|
26
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
26
27
|
spec.add_development_dependency "stub_env"
|
27
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-multiprocess_runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rhett Sutphin
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2020-05-28 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|
@@ -59,16 +59,16 @@ dependencies:
|
|
59
59
|
name: rake
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
|
-
- - "
|
62
|
+
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version:
|
64
|
+
version: 12.3.3
|
65
65
|
type: :development
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
|
-
- - "
|
69
|
+
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version:
|
71
|
+
version: 12.3.3
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
73
|
name: stub_env
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
|
-
rubygems_version: 3.0.
|
134
|
+
rubygems_version: 3.0.3
|
135
135
|
signing_key:
|
136
136
|
specification_version: 4
|
137
137
|
summary: A runner for RSpec 3 that uses multiple processes to execute specs in parallel
|