ci-queue 0.20.6 → 0.21.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/ci/queue/configuration.rb +8 -1
- data/lib/ci/queue/redis/supervisor.rb +2 -2
- data/lib/ci/queue/redis/worker.rb +1 -0
- data/lib/ci/queue/version.rb +1 -1
- data/lib/minitest/queue/junit_reporter.rb +4 -0
- data/lib/minitest/queue/runner.rb +10 -1
- data/lib/minitest/queue/test_data.rb +15 -1
- data/lib/minitest/queue.rb +24 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9a1d5f8211c29b9993d6ef94acff329a040d7e940b28e8d51eedc01e87c106b
|
4
|
+
data.tar.gz: d584ef67d1f2036b4c8b7880099515ff2a4f0618c2813e9caee099cfe11e587f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88ddaa2717da8b9a989fa6d7bf859d509c29d2cf19ade4fcab882f6dfe4b33e1969c5f89121f3b5dfb1439b03e89e41227cf9f9f8e33d7e9295e43c7a2cb8e51
|
7
|
+
data.tar.gz: e7f5753cd1bdfd0f7500ebe00be9e7caf3a342ae931b974971bc95aa8ab27e86744211036a4fe70420a80d374235e1eb1ea6ce6eee4e14da52560502f1c26413
|
@@ -8,6 +8,7 @@ module CI
|
|
8
8
|
attr_accessor :max_test_failed
|
9
9
|
attr_reader :circuit_breakers
|
10
10
|
attr_writer :seed, :build_id
|
11
|
+
attr_writer :queue_init_timeout
|
11
12
|
|
12
13
|
class << self
|
13
14
|
def from_env(env)
|
@@ -32,7 +33,8 @@ module CI
|
|
32
33
|
timeout: 30, build_id: nil, worker_id: nil, max_requeues: 0, requeue_tolerance: 0,
|
33
34
|
namespace: nil, seed: nil, flaky_tests: [], statsd_endpoint: nil, max_consecutive_failures: nil,
|
34
35
|
grind_count: nil, max_duration: nil, failure_file: nil, max_test_duration: nil,
|
35
|
-
max_test_duration_percentile: 0.5, track_test_duration: false, max_test_failed: nil
|
36
|
+
max_test_duration_percentile: 0.5, track_test_duration: false, max_test_failed: nil,
|
37
|
+
queue_init_timeout: nil
|
36
38
|
)
|
37
39
|
@build_id = build_id
|
38
40
|
@circuit_breakers = [CircuitBreaker::Disabled]
|
@@ -48,12 +50,17 @@ module CI
|
|
48
50
|
@seed = seed
|
49
51
|
@statsd_endpoint = statsd_endpoint
|
50
52
|
@timeout = timeout
|
53
|
+
@queue_init_timeout = queue_init_timeout
|
51
54
|
@track_test_duration = track_test_duration
|
52
55
|
@worker_id = worker_id
|
53
56
|
self.max_consecutive_failures = max_consecutive_failures
|
54
57
|
self.max_duration = max_duration
|
55
58
|
end
|
56
59
|
|
60
|
+
def queue_init_timeout
|
61
|
+
@queue_init_timeout || timeout
|
62
|
+
end
|
63
|
+
|
57
64
|
def max_consecutive_failures=(max)
|
58
65
|
if max
|
59
66
|
@circuit_breakers << CircuitBreaker::MaxConsecutiveFailures.new(max_consecutive_failures: max)
|
@@ -8,7 +8,7 @@ module CI
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def total
|
11
|
-
wait_for_master(timeout: config.
|
11
|
+
wait_for_master(timeout: config.queue_init_timeout)
|
12
12
|
redis.get(key('total')).to_i
|
13
13
|
end
|
14
14
|
|
@@ -17,7 +17,7 @@ module CI
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def wait_for_workers
|
20
|
-
|
20
|
+
wait_for_master(timeout: config.queue_init_timeout)
|
21
21
|
|
22
22
|
yield if block_given?
|
23
23
|
|
data/lib/ci/queue/version.rb
CHANGED
@@ -7,6 +7,8 @@ require 'fileutils'
|
|
7
7
|
module Minitest
|
8
8
|
module Queue
|
9
9
|
class JUnitReporter < Minitest::Reporters::BaseReporter
|
10
|
+
include ::CI::Queue::OutputHelpers
|
11
|
+
|
10
12
|
def initialize(report_path = 'log/junit.xml', options = {})
|
11
13
|
super({})
|
12
14
|
@report_path = File.absolute_path(report_path)
|
@@ -76,6 +78,8 @@ module Minitest
|
|
76
78
|
|
77
79
|
testcase = testsuite.add_element('testcase', attributes)
|
78
80
|
add_xml_message_for(testcase, test) unless test.passed?
|
81
|
+
rescue REXML::ParseException, RuntimeError => error
|
82
|
+
step(red("Skipping adding '#{suite}##{test.name}' to JUnit report: #{error.message}"))
|
79
83
|
end
|
80
84
|
end
|
81
85
|
|
@@ -352,7 +352,7 @@ module Minitest
|
|
352
352
|
|
353
353
|
help = <<~EOS
|
354
354
|
Specify a timeout after which if a test haven't completed, it will be picked up by another worker.
|
355
|
-
It is very important to set this
|
355
|
+
It is very important to set this value higher than the slowest test in the suite, otherwise performance will be impacted.
|
356
356
|
Defaults to 30 seconds.
|
357
357
|
EOS
|
358
358
|
opts.separator ""
|
@@ -360,6 +360,15 @@ module Minitest
|
|
360
360
|
queue_config.timeout = timeout
|
361
361
|
end
|
362
362
|
|
363
|
+
help = <<~EOS
|
364
|
+
Specify a timeout to elect the leader and populate the queue.
|
365
|
+
Defaults to the value set for --timeout.
|
366
|
+
EOS
|
367
|
+
opts.separator ""
|
368
|
+
opts.on('--queue-init-timeout TIMEOUT', Float, help) do |timeout|
|
369
|
+
queue_config.queue_init_timeout = timeout
|
370
|
+
end
|
371
|
+
|
363
372
|
help = <<~EOS
|
364
373
|
Specify $LOAD_PATH directory, similar to Ruby's -I
|
365
374
|
EOS
|
@@ -52,6 +52,14 @@ module Minitest
|
|
52
52
|
@test.time
|
53
53
|
end
|
54
54
|
|
55
|
+
def test_start_timestamp
|
56
|
+
@test.start_timestamp
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_finish_timestamp
|
60
|
+
@test.finish_timestamp
|
61
|
+
end
|
62
|
+
|
55
63
|
def test_file_path
|
56
64
|
path = @test.source_location.first
|
57
65
|
begin
|
@@ -82,7 +90,11 @@ module Minitest
|
|
82
90
|
return nil unless @test.failure
|
83
91
|
|
84
92
|
path = error_location(@test.failure).first
|
85
|
-
|
93
|
+
begin
|
94
|
+
relative_path_for(path)
|
95
|
+
rescue ArgumentError
|
96
|
+
path # e.g. "(eval)" etc.
|
97
|
+
end
|
86
98
|
end
|
87
99
|
|
88
100
|
def error_file_number
|
@@ -103,6 +115,8 @@ module Minitest
|
|
103
115
|
test_retried: test_retried,
|
104
116
|
test_assertions: test_assertions,
|
105
117
|
test_duration: test_duration,
|
118
|
+
test_start_timestamp: test_start_timestamp,
|
119
|
+
test_finish_timestamp: test_finish_timestamp,
|
106
120
|
test_file_path: test_file_path,
|
107
121
|
test_file_line_number: test_file_line_number,
|
108
122
|
error_class: error_class,
|
data/lib/minitest/queue.rb
CHANGED
@@ -102,6 +102,10 @@ module Minitest
|
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
|
+
module WithTimestamps
|
106
|
+
attr_accessor :start_timestamp, :finish_timestamp
|
107
|
+
end
|
108
|
+
|
105
109
|
module Queue
|
106
110
|
attr_writer :run_command_formatter, :project_root
|
107
111
|
|
@@ -159,13 +163,30 @@ module Minitest
|
|
159
163
|
id <=> other.id
|
160
164
|
end
|
161
165
|
|
166
|
+
def with_timestamps
|
167
|
+
start_timestamp = current_timestamp
|
168
|
+
result = yield
|
169
|
+
result
|
170
|
+
ensure
|
171
|
+
result.start_timestamp = start_timestamp
|
172
|
+
result.finish_timestamp = current_timestamp
|
173
|
+
end
|
174
|
+
|
162
175
|
def run
|
163
|
-
|
176
|
+
with_timestamps do
|
177
|
+
Minitest.run_one_method(@runnable, @method_name)
|
178
|
+
end
|
164
179
|
end
|
165
180
|
|
166
181
|
def flaky?
|
167
182
|
Minitest.queue.flaky?(self)
|
168
183
|
end
|
184
|
+
|
185
|
+
private
|
186
|
+
|
187
|
+
def current_timestamp
|
188
|
+
Time.now.to_i
|
189
|
+
end
|
169
190
|
end
|
170
191
|
|
171
192
|
attr_reader :queue
|
@@ -244,9 +265,11 @@ MiniTest.singleton_class.prepend(MiniTest::Queue)
|
|
244
265
|
if defined? MiniTest::Result
|
245
266
|
MiniTest::Result.prepend(MiniTest::Requeueing)
|
246
267
|
MiniTest::Result.prepend(MiniTest::Flakiness)
|
268
|
+
MiniTest::Result.prepend(MiniTest::WithTimestamps)
|
247
269
|
else
|
248
270
|
MiniTest::Test.prepend(MiniTest::Requeueing)
|
249
271
|
MiniTest::Test.prepend(MiniTest::Flakiness)
|
272
|
+
MiniTest::Test.prepend(MiniTest::WithTimestamps)
|
250
273
|
|
251
274
|
module MinitestBackwardCompatibility
|
252
275
|
def source_location
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ci-queue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -238,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
238
238
|
- !ruby/object:Gem::Version
|
239
239
|
version: '0'
|
240
240
|
requirements: []
|
241
|
-
rubygems_version: 3.
|
241
|
+
rubygems_version: 3.2.20
|
242
242
|
signing_key:
|
243
243
|
specification_version: 4
|
244
244
|
summary: Distribute tests over many workers using a queue
|