test-queue 0.4.2 → 0.5.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 +5 -5
- data/Gemfile-cucumber1-3.lock +1 -1
- data/Gemfile-cucumber2-4.lock +1 -1
- data/Gemfile-minitest4.lock +1 -1
- data/Gemfile-minitest5.lock +1 -1
- data/Gemfile-rspec2-1.lock +1 -1
- data/Gemfile-rspec3-0.lock +1 -1
- data/Gemfile-rspec3-1.lock +1 -1
- data/Gemfile-rspec3-2.lock +1 -1
- data/Gemfile-testunit.lock +1 -1
- data/Gemfile.lock +1 -1
- data/LICENSE +21 -0
- data/README.md +7 -7
- data/lib/test_queue/runner/rspec.rb +2 -6
- data/lib/test_queue/runner/rspec2.rb +6 -0
- data/lib/test_queue/runner/rspec3.rb +6 -0
- data/lib/test_queue/runner.rb +18 -13
- data/test/minitest5.bats +10 -0
- data/test-queue.gemspec +2 -3
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4c32b025eec2391d8523ce84f4f180443b09f003f8770b8b27ff741aac464629
|
4
|
+
data.tar.gz: 6a18a116cba1ec57617f92405a5d4554dab34dc5ab41be6ed10825b9c8b9f503
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7be91c62fc0e8f47826b441ed36f08ce454caf53bb56af03b11a3f7ed0eb88028ecb7ec96b03baf413ef985401292fee055561e876012c88e7e63fc7007ae00
|
7
|
+
data.tar.gz: 27e6d8fbaf61bf96beede058ad5a25ae8695a88fb3ce3d14ba96666e8da2b1df066574aa7efa0f9bcd5cbd619d1825a0a8c4f4cbe20f0eb312b2f9692f7a3d49
|
data/Gemfile-cucumber1-3.lock
CHANGED
data/Gemfile-cucumber2-4.lock
CHANGED
data/Gemfile-minitest4.lock
CHANGED
data/Gemfile-minitest5.lock
CHANGED
data/Gemfile-rspec2-1.lock
CHANGED
data/Gemfile-rspec3-0.lock
CHANGED
data/Gemfile-rspec3-1.lock
CHANGED
data/Gemfile-rspec3-2.lock
CHANGED
data/Gemfile-testunit.lock
CHANGED
data/Gemfile.lock
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 Aman Gupta
|
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
@@ -35,9 +35,9 @@ the workload and relay results back to a central master.
|
|
35
35
|
- `TEST_QUEUE_RELAY`: relay results back to a central master, specified as tcp `address:port`
|
36
36
|
- `TEST_QUEUE_STATS`: `path` to cache build stats in-build CI runs (default: `.test_queue_stats`)
|
37
37
|
- `TEST_QUEUE_FORCE`: comma separated list of suites to run
|
38
|
-
- `TEST_QUEUE_RELAY_TIMEOUT`: when using
|
39
|
-
- `TEST_QUEUE_RELAY_TOKEN`: when using
|
40
|
-
- `
|
38
|
+
- `TEST_QUEUE_RELAY_TIMEOUT`: when using distributed builds, the amount of time a remote master will try to reconnect to start work
|
39
|
+
- `TEST_QUEUE_RELAY_TOKEN`: when using distributed builds, this must be the same on remote masters and the central master for remote masters to be able to connect.
|
40
|
+
- `TEST_QUEUE_REMOTE_MASTER_MESSAGE`: when using distributed builds, set this on a remote master and it will appear in that master's connection message on the central master.
|
41
41
|
- `TEST_QUEUE_SPLIT_GROUPS`: split tests up by example rather than example group. Faster for tests with short setup time such as selenium. RSpec only. Add the :no_split tag to ExampleGroups you don't want split.
|
42
42
|
|
43
43
|
### usage
|
@@ -83,8 +83,8 @@ class MyAppTestRunner < TestQueue::Runner::MiniTest
|
|
83
83
|
# ...
|
84
84
|
end
|
85
85
|
|
86
|
-
# If this is a remote
|
87
|
-
@
|
86
|
+
# If this is a remote master, tell the central master something about us
|
87
|
+
@remote_master_message = "Output for remote master 123: http://myhost.com/build/123"
|
88
88
|
end
|
89
89
|
|
90
90
|
def around_filter(suite)
|
@@ -100,8 +100,8 @@ MyAppTestRunner.new.execute
|
|
100
100
|
### distributed mode
|
101
101
|
|
102
102
|
To use distributed mode, the central master must listen on a tcp port. Additional masters can be booted
|
103
|
-
in relay mode to connect to the central master.
|
104
|
-
the master's.
|
103
|
+
in relay mode to connect to the central master. Remote masters must provide a TEST_QUEUE_RELAY_TOKEN
|
104
|
+
to match the central master's.
|
105
105
|
|
106
106
|
```
|
107
107
|
$ TEST_QUEUE_RELAY_TOKEN=123 TEST_QUEUE_SOCKET=0.0.0.0:12345 bundle exec minitest-queue ./test/sample_test.rb
|
@@ -10,12 +10,6 @@ else
|
|
10
10
|
fail 'requires rspec version 2 or 3'
|
11
11
|
end
|
12
12
|
|
13
|
-
class ::RSpec::Core::ExampleGroup
|
14
|
-
def self.failure_count
|
15
|
-
examples.map {|e| e.execution_result[:status] == "failed"}.length
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
13
|
module TestQueue
|
20
14
|
class Runner
|
21
15
|
class RSpec < Runner
|
@@ -53,6 +47,8 @@ module TestQueue
|
|
53
47
|
example_or_group.id
|
54
48
|
elsif example_or_group.respond_to?(:full_description)
|
55
49
|
example_or_group.full_description
|
50
|
+
elsif example_or_group.metadata.key?(:full_description)
|
51
|
+
example_or_group.metadata[:full_description]
|
56
52
|
else
|
57
53
|
example_or_group.metadata[:example_group][:full_description]
|
58
54
|
end
|
data/lib/test_queue/runner.rb
CHANGED
@@ -37,6 +37,7 @@ module TestQueue
|
|
37
37
|
@test_framework = test_framework
|
38
38
|
@stats = Stats.new(stats_file)
|
39
39
|
|
40
|
+
@early_failure_limit = nil
|
40
41
|
if ENV['TEST_QUEUE_EARLY_FAILURE_LIMIT']
|
41
42
|
begin
|
42
43
|
@early_failure_limit = Integer(ENV['TEST_QUEUE_EARLY_FAILURE_LIMIT'])
|
@@ -85,7 +86,7 @@ module TestQueue
|
|
85
86
|
raise ArgumentError, "Worker count (#{@concurrency}) must be greater than 0"
|
86
87
|
end
|
87
88
|
|
88
|
-
@
|
89
|
+
@relay_connection_timeout =
|
89
90
|
(ENV['TEST_QUEUE_RELAY_TIMEOUT'] && ENV['TEST_QUEUE_RELAY_TIMEOUT'].to_i) ||
|
90
91
|
30
|
91
92
|
|
@@ -100,7 +101,12 @@ module TestQueue
|
|
100
101
|
relay ||
|
101
102
|
ENV['TEST_QUEUE_RELAY']
|
102
103
|
|
103
|
-
@
|
104
|
+
@remote_master_message = if ENV.has_key?("TEST_QUEUE_REMOTE_MASTER_MESSAGE")
|
105
|
+
ENV["TEST_QUEUE_REMOTE_MASTER_MESSAGE"]
|
106
|
+
elsif ENV.has_key?("TEST_QUEUE_SLAVE_MESSAGE")
|
107
|
+
warn("`TEST_QUEUE_SLAVE_MESSAGE` is deprecated. Use `TEST_QUEUE_REMOTE_MASTER_MESSAGE` instead.")
|
108
|
+
ENV["TEST_QUEUE_SLAVE_MESSAGE"]
|
109
|
+
end
|
104
110
|
|
105
111
|
if @relay == @socket
|
106
112
|
STDERR.puts "*** Detected TEST_QUEUE_RELAY == TEST_QUEUE_SOCKET. Disabling relay mode."
|
@@ -265,10 +271,10 @@ module TestQueue
|
|
265
271
|
return unless relay?
|
266
272
|
|
267
273
|
sock = connect_to_relay
|
268
|
-
message = @
|
274
|
+
message = @remote_master_message ? " #{@remote_master_message}" : ""
|
269
275
|
message.gsub!(/(\r|\n)/, "") # Our "protocol" is newline-separated
|
270
276
|
sock.puts("TOKEN=#{@run_token}")
|
271
|
-
sock.puts("
|
277
|
+
sock.puts("REMOTE MASTER #{@concurrency} #{Socket.gethostname} #{message}")
|
272
278
|
response = sock.gets.strip
|
273
279
|
unless response == "OK"
|
274
280
|
STDERR.puts "*** Got non-OK response from master: #{response}"
|
@@ -485,7 +491,7 @@ module TestQueue
|
|
485
491
|
cmd = sock.gets.strip
|
486
492
|
|
487
493
|
token = token[TOKEN_REGEX, 1]
|
488
|
-
# If we have a
|
494
|
+
# If we have a remote master from a different test run, respond with "WRONG RUN", and it will consider the test run done.
|
489
495
|
if token != @run_token
|
490
496
|
message = token.nil? ? "Worker sent no token to master" : "Worker from run #{token} connected to master"
|
491
497
|
STDERR.puts "*** #{message} for run #{@run_token}; ignoring."
|
@@ -495,7 +501,6 @@ module TestQueue
|
|
495
501
|
|
496
502
|
case cmd
|
497
503
|
when /^POP (\S+) (\d+)/
|
498
|
-
# If we have a slave from a different test run, don't respond, and it will consider the test run done.
|
499
504
|
hostname = $1
|
500
505
|
pid = Integer($2)
|
501
506
|
if awaiting_suites?
|
@@ -505,16 +510,16 @@ module TestQueue
|
|
505
510
|
sock.write(data)
|
506
511
|
@assignments[obj] = [hostname, pid]
|
507
512
|
end
|
508
|
-
when /^
|
513
|
+
when /^REMOTE MASTER (\d+) ([\w\.-]+)(?: (.+))?/
|
509
514
|
num = $1.to_i
|
510
|
-
|
511
|
-
|
515
|
+
remote_master = $2
|
516
|
+
remote_master_message = $3
|
512
517
|
|
513
518
|
sock.write("OK\n")
|
514
519
|
remote_workers += num
|
515
520
|
|
516
|
-
message = "*** #{num} workers connected from #{
|
517
|
-
message << " " +
|
521
|
+
message = "*** #{num} workers connected from #{remote_master} after #{Time.now-@start_time}s"
|
522
|
+
message << " " + remote_master_message if remote_master_message
|
518
523
|
STDERR.puts message
|
519
524
|
when /^WORKER (\d+)/
|
520
525
|
data = sock.read($1.to_i)
|
@@ -546,12 +551,12 @@ module TestQueue
|
|
546
551
|
def connect_to_relay
|
547
552
|
sock = nil
|
548
553
|
start = Time.now
|
549
|
-
puts "Attempting to connect for #{@
|
554
|
+
puts "Attempting to connect for #{@relay_connection_timeout}s..."
|
550
555
|
while sock.nil?
|
551
556
|
begin
|
552
557
|
sock = TCPSocket.new(*@relay.split(':'))
|
553
558
|
rescue Errno::ECONNREFUSED => e
|
554
|
-
raise e if Time.now - start > @
|
559
|
+
raise e if Time.now - start > @relay_connection_timeout
|
555
560
|
puts "Master not yet available, sleeping..."
|
556
561
|
sleep 0.5
|
557
562
|
end
|
data/test/minitest5.bats
CHANGED
@@ -128,6 +128,16 @@ assert_test_queue_force_ordering() {
|
|
128
128
|
assert_output_contains "MiniTestFailure#test_fail"
|
129
129
|
}
|
130
130
|
|
131
|
+
@test "multi-master central master prints out remote master messages" {
|
132
|
+
export TEST_QUEUE_RELAY_TOKEN=$(date | cksum | cut -d' ' -f1)
|
133
|
+
TEST_QUEUE_RELAY=0.0.0.0:12345 TEST_QUEUE_REMOTE_MASTER_MESSAGE="hello from remote master" bundle exec minitest-queue ./test/samples/sample_minitest5.rb &
|
134
|
+
TEST_QUEUE_SOCKET=0.0.0.0:12345 run bundle exec minitest-queue ./test/samples/sample_minitest5.rb
|
135
|
+
wait
|
136
|
+
|
137
|
+
assert_status 0
|
138
|
+
assert_output_contains "hello from remote master"
|
139
|
+
}
|
140
|
+
|
131
141
|
@test "recovers from child processes dying in an unorderly way" {
|
132
142
|
export KILL=1
|
133
143
|
run bundle exec minitest-queue ./test/samples/sample_minitest5.rb
|
data/test-queue.gemspec
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
spec = Gem::Specification.new do |s|
|
2
2
|
s.name = 'test-queue'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '0.5.0'
|
4
4
|
s.summary = 'parallel test runner'
|
5
5
|
s.description = 'minitest/rspec parallel test runner for CI environments'
|
6
6
|
|
7
|
-
s.homepage = "
|
7
|
+
s.homepage = "https://github.com/tmm1/test-queue"
|
8
8
|
|
9
9
|
s.authors = ["Aman Gupta"]
|
10
10
|
s.email = "ruby@tmm1.net"
|
11
11
|
s.license = 'MIT'
|
12
12
|
|
13
|
-
s.has_rdoc = false
|
14
13
|
s.bindir = 'bin'
|
15
14
|
s.executables << 'rspec-queue'
|
16
15
|
s.executables << 'minitest-queue'
|
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.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aman Gupta
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-16 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
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- Gemfile-testunit
|
43
43
|
- Gemfile-testunit.lock
|
44
44
|
- Gemfile.lock
|
45
|
+
- LICENSE
|
45
46
|
- README.md
|
46
47
|
- bin/cucumber-queue
|
47
48
|
- bin/minitest-queue
|
@@ -89,11 +90,11 @@ files:
|
|
89
90
|
- test/sleepy_runner.rb
|
90
91
|
- test/testlib.bash
|
91
92
|
- test/testunit.bats
|
92
|
-
homepage:
|
93
|
+
homepage: https://github.com/tmm1/test-queue
|
93
94
|
licenses:
|
94
95
|
- MIT
|
95
96
|
metadata: {}
|
96
|
-
post_install_message:
|
97
|
+
post_install_message:
|
97
98
|
rdoc_options: []
|
98
99
|
require_paths:
|
99
100
|
- lib
|
@@ -108,9 +109,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
109
|
- !ruby/object:Gem::Version
|
109
110
|
version: '0'
|
110
111
|
requirements: []
|
111
|
-
|
112
|
-
|
113
|
-
signing_key:
|
112
|
+
rubygems_version: 3.3.3
|
113
|
+
signing_key:
|
114
114
|
specification_version: 4
|
115
115
|
summary: parallel test runner
|
116
116
|
test_files: []
|