test-queue 0.8.0 → 0.10.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/lib/test_queue/iterator.rb +0 -2
- data/lib/test_queue/runner/minitest.rb +5 -7
- data/lib/test_queue/runner/rspec.rb +20 -11
- data/lib/test_queue/runner.rb +7 -10
- data/lib/test_queue/version.rb +1 -1
- metadata +3 -5
- data/lib/test_queue/runner/minitest4.rb +0 -93
- data/lib/test_queue/runner/rspec2.rb +0 -44
- /data/lib/test_queue/runner/{rspec3.rb → rspec_ext.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf82719e0483ccba7f40a8a66ffdd0d262bd2ff79cae203055e730988eed1219
|
4
|
+
data.tar.gz: 584b68033ee5540cc1c2aaeeb1c391e04ff67b158e6c170975151397ea287c66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 041b553cf8d565683e9bf304e043ca0e44346a14243969834d4dc5e3d98f8ada5c96ada0e42ad0da4d4ccc488322013b632b6f2cde4633908d7b526915c7af74
|
7
|
+
data.tar.gz: ac21ecddc2d3236e5b7de2bc0d138ac791d420efea33a43286294169fba4082329de1540c614153273cc0783e8897b9700bd24469fbad660168c22ec86c9ae65
|
data/lib/test_queue/iterator.rb
CHANGED
@@ -38,10 +38,8 @@ module TestQueue
|
|
38
38
|
end
|
39
39
|
break if client.nil?
|
40
40
|
|
41
|
-
# rubocop:disable Lint/IncompatibleIoSelectWithFiberScheduler
|
42
41
|
# This false positive will be resolved by https://github.com/rubocop/rubocop/pull/11830.
|
43
42
|
_r, _w, e = IO.select([client], nil, [client], nil)
|
44
|
-
# rubocop:enable Lint/IncompatibleIoSelectWithFiberScheduler
|
45
43
|
break unless e.empty?
|
46
44
|
|
47
45
|
if (data = client.read(65536))
|
@@ -1,12 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
require_relative '../runner/minitest4'
|
9
|
-
end
|
3
|
+
require 'minitest'
|
4
|
+
|
5
|
+
raise 'requires Minitest version 5' unless Minitest::VERSION.to_i == 5
|
6
|
+
|
7
|
+
require_relative '../runner/minitest5'
|
10
8
|
|
11
9
|
module TestQueue
|
12
10
|
class Runner
|
@@ -1,33 +1,42 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '../runner'
|
4
3
|
require 'rspec/core'
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
require_relative 'rspec3'
|
11
|
-
else
|
12
|
-
raise 'requires rspec version 2, 3, or 4'
|
13
|
-
end
|
5
|
+
raise 'requires RSpec version 3 or 4' unless [3, 4].include?(RSpec::Core::Version::STRING.to_i)
|
6
|
+
|
7
|
+
require_relative 'rspec_ext'
|
8
|
+
require_relative '../runner'
|
14
9
|
|
15
10
|
module TestQueue
|
16
11
|
class Runner
|
17
12
|
class RSpec < Runner
|
18
13
|
def initialize
|
19
14
|
super(TestFramework::RSpec.new)
|
15
|
+
|
16
|
+
@rspec = ::RSpec::Core::QueueRunner.new
|
17
|
+
end
|
18
|
+
|
19
|
+
def start_master
|
20
|
+
seed_notification = ::RSpec::Core::Notifications::SeedNotification.new(@rspec.configuration.seed, seed_used?)
|
21
|
+
puts "#{seed_notification.fully_formatted}\n"
|
22
|
+
|
23
|
+
super
|
20
24
|
end
|
21
25
|
|
22
26
|
def run_worker(iterator)
|
23
|
-
rspec
|
24
|
-
rspec.run_each(iterator).to_i
|
27
|
+
@rspec.run_each(iterator).to_i
|
25
28
|
end
|
26
29
|
|
27
30
|
def summarize_worker(worker)
|
28
31
|
worker.summary = worker.lines.grep(/ examples?, /).first
|
29
32
|
worker.failure_output = worker.output[/^Failures:\n\n(.*)\n^Finished/m, 1]
|
30
33
|
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def seed_used?
|
38
|
+
@rspec.configuration.seed && @rspec.configuration.seed_used?
|
39
|
+
end
|
31
40
|
end
|
32
41
|
end
|
33
42
|
|
data/lib/test_queue/runner.rb
CHANGED
@@ -90,13 +90,7 @@ module TestQueue
|
|
90
90
|
@run_token = ENV['TEST_QUEUE_RELAY_TOKEN'] || SecureRandom.hex(8)
|
91
91
|
@socket = socket || ENV['TEST_QUEUE_SOCKET'] || "/tmp/test_queue_#{$$}_#{object_id}.sock"
|
92
92
|
@relay = relay || ENV['TEST_QUEUE_RELAY']
|
93
|
-
|
94
|
-
@remote_master_message = if ENV.key?('TEST_QUEUE_REMOTE_MASTER_MESSAGE')
|
95
|
-
ENV['TEST_QUEUE_REMOTE_MASTER_MESSAGE']
|
96
|
-
elsif ENV.key?('TEST_QUEUE_SLAVE_MESSAGE')
|
97
|
-
warn('`TEST_QUEUE_SLAVE_MESSAGE` is deprecated. Use `TEST_QUEUE_REMOTE_MASTER_MESSAGE` instead.')
|
98
|
-
ENV['TEST_QUEUE_SLAVE_MESSAGE']
|
99
|
-
end
|
93
|
+
@remote_master_message = ENV['TEST_QUEUE_REMOTE_MASTER_MESSAGE'] if ENV.key?('TEST_QUEUE_REMOTE_MASTER_MESSAGE')
|
100
94
|
|
101
95
|
if @relay == @socket
|
102
96
|
warn '*** Detected TEST_QUEUE_RELAY == TEST_QUEUE_SOCKET. Disabling relay mode.'
|
@@ -323,7 +317,9 @@ module TestQueue
|
|
323
317
|
|
324
318
|
@server.connect_address.connect do |sock|
|
325
319
|
sock.puts("TOKEN=#{@run_token}")
|
326
|
-
|
320
|
+
data = Marshal.dump([suite_name, path])
|
321
|
+
sock.puts("NEW SUITE #{data.bytesize}")
|
322
|
+
sock.write(data)
|
327
323
|
end
|
328
324
|
end
|
329
325
|
end
|
@@ -513,8 +509,9 @@ module TestQueue
|
|
513
509
|
worker = Marshal.load(data)
|
514
510
|
worker_completed(worker)
|
515
511
|
remote_workers -= 1
|
516
|
-
when /\ANEW SUITE (
|
517
|
-
|
512
|
+
when /\ANEW SUITE (\d+)/
|
513
|
+
data = sock.read($1.to_i)
|
514
|
+
suite_name, path = Marshal.load(data)
|
518
515
|
enqueue_discovered_suite(suite_name, path)
|
519
516
|
when /\AKABOOM/
|
520
517
|
# worker reporting an abnormal number of test failures;
|
data/lib/test_queue/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-queue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aman Gupta
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: minitest/rspec parallel test runner for CI environments
|
14
14
|
email: ruby@tmm1.net
|
@@ -33,12 +33,10 @@ files:
|
|
33
33
|
- lib/test_queue/runner/cucumber.rb
|
34
34
|
- lib/test_queue/runner/example.rb
|
35
35
|
- lib/test_queue/runner/minitest.rb
|
36
|
-
- lib/test_queue/runner/minitest4.rb
|
37
36
|
- lib/test_queue/runner/minitest5.rb
|
38
37
|
- lib/test_queue/runner/puppet_lint.rb
|
39
38
|
- lib/test_queue/runner/rspec.rb
|
40
|
-
- lib/test_queue/runner/
|
41
|
-
- lib/test_queue/runner/rspec3.rb
|
39
|
+
- lib/test_queue/runner/rspec_ext.rb
|
42
40
|
- lib/test_queue/runner/testunit.rb
|
43
41
|
- lib/test_queue/stats.rb
|
44
42
|
- lib/test_queue/test_framework.rb
|
@@ -1,93 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../runner'
|
4
|
-
require 'set'
|
5
|
-
require 'stringio'
|
6
|
-
|
7
|
-
class MiniTestQueueRunner < MiniTest::Unit
|
8
|
-
def _run_suites(suites, type)
|
9
|
-
self.class.output = $stdout
|
10
|
-
|
11
|
-
if defined?(ParallelEach)
|
12
|
-
# Ignore its _run_suites implementation since we don't handle it gracefully.
|
13
|
-
# If we don't do this #partition is called on the iterator and all suites
|
14
|
-
# distributed immediately, instead of picked up as workers are available.
|
15
|
-
suites.map { |suite| _run_suite suite, type }
|
16
|
-
else
|
17
|
-
super
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def _run_anything(*)
|
22
|
-
ret = super
|
23
|
-
output.puts
|
24
|
-
ret
|
25
|
-
end
|
26
|
-
|
27
|
-
def _run_suite(suite, type)
|
28
|
-
output.print ' '
|
29
|
-
output.print suite
|
30
|
-
output.print ': '
|
31
|
-
|
32
|
-
start = Time.now
|
33
|
-
ret = super
|
34
|
-
diff = Time.now - start
|
35
|
-
|
36
|
-
output.puts(' <%.3f>' % diff)
|
37
|
-
ret
|
38
|
-
end
|
39
|
-
|
40
|
-
self.runner = new
|
41
|
-
self.output = StringIO.new
|
42
|
-
end
|
43
|
-
|
44
|
-
class MiniTest::Unit::TestCase
|
45
|
-
class << self
|
46
|
-
attr_accessor :test_suites
|
47
|
-
|
48
|
-
def original_test_suites
|
49
|
-
@@test_suites.keys.reject { |s| s.test_methods.empty? }
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def failure_count
|
54
|
-
failures.length
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
module TestQueue
|
59
|
-
class Runner
|
60
|
-
class Minitest < Runner
|
61
|
-
def initialize
|
62
|
-
if ::MiniTest::Unit::TestCase.original_test_suites.any?
|
63
|
-
raise 'Do not `require` test files. Pass them via ARGV instead and they will be required as needed.'
|
64
|
-
end
|
65
|
-
|
66
|
-
super(TestFramework::Minitest.new)
|
67
|
-
end
|
68
|
-
|
69
|
-
def run_worker(iterator)
|
70
|
-
::MiniTest::Unit::TestCase.test_suites = iterator
|
71
|
-
::MiniTest::Unit.new.run
|
72
|
-
end
|
73
|
-
end
|
74
|
-
MiniTest = Minitest # For compatibility with test-queue 0.7.0 and earlier.
|
75
|
-
end
|
76
|
-
|
77
|
-
class TestFramework
|
78
|
-
class Minitest < TestFramework
|
79
|
-
def all_suite_files
|
80
|
-
ARGV
|
81
|
-
end
|
82
|
-
|
83
|
-
def suites_from_file(path)
|
84
|
-
::MiniTest::Unit::TestCase.reset
|
85
|
-
require File.absolute_path(path)
|
86
|
-
::MiniTest::Unit::TestCase.original_test_suites.map { |suite|
|
87
|
-
[suite.name, suite]
|
88
|
-
}
|
89
|
-
end
|
90
|
-
end
|
91
|
-
MiniTest = Minitest # For compatibility with test-queue 0.7.0 and earlier.
|
92
|
-
end
|
93
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class ::RSpec::Core::ExampleGroup
|
4
|
-
def self.failure_count
|
5
|
-
examples.map { |e| e.execution_result[:status] == 'failed' }.length
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
module RSpec::Core
|
10
|
-
class QueueRunner < CommandLine
|
11
|
-
def initialize
|
12
|
-
super(ARGV)
|
13
|
-
@configuration.output_stream = $stdout
|
14
|
-
@configuration.error_stream = $stderr
|
15
|
-
end
|
16
|
-
|
17
|
-
def run_each(iterator)
|
18
|
-
@configuration.reporter.report(0, @configuration.randomize? ? @configuration.seed : nil) do |reporter|
|
19
|
-
@configuration.run_hook(:before, :suite)
|
20
|
-
iterator.map { |g|
|
21
|
-
if g.is_a? ::RSpec::Core::Example
|
22
|
-
print " #{g.full_description}: "
|
23
|
-
example = g
|
24
|
-
g = example.example_group
|
25
|
-
::RSpec.world.filtered_examples.clear
|
26
|
-
examples = [example]
|
27
|
-
examples.extend(::RSpec::Core::Extensions::Ordered::Examples)
|
28
|
-
::RSpec.world.filtered_examples[g] = examples
|
29
|
-
else
|
30
|
-
print " #{g.description}: "
|
31
|
-
end
|
32
|
-
start = Time.now
|
33
|
-
ret = g.run(reporter)
|
34
|
-
diff = Time.now - start
|
35
|
-
puts(' <%.3f>' % diff)
|
36
|
-
|
37
|
-
ret
|
38
|
-
}.all? ? 0 : @configuration.failure_exit_code
|
39
|
-
ensure
|
40
|
-
@configuration.run_hook(:after, :suite)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
File without changes
|