ci-queue 0.38.0 → 0.40.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dev.yml +1 -1
- data/lib/ci/queue/configuration.rb +3 -2
- data/lib/ci/queue/redis/base.rb +6 -1
- data/lib/ci/queue/redis/build_record.rb +7 -0
- data/lib/ci/queue/redis.rb +1 -0
- data/lib/ci/queue/version.rb +1 -1
- data/lib/minitest/queue/build_status_reporter.rb +10 -0
- data/lib/minitest/queue/runner.rb +19 -8
- 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: be4adb99c549118b56b3b989e226acd24276f2105cd407ebe7c60685b439712f
|
4
|
+
data.tar.gz: 53ad2297734965e9eb942710e6c6e0dcff81b2597d864f1c0336cbf88c5b792d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5748d3f7cb1b9a9dd9cd386394c6e812f900fe7883686e920b8d2375fbb4fbfaf6c1a1a78703866f1bc3a64bf704cb21188c9fe3b1ddf762490aa1a36344770
|
7
|
+
data.tar.gz: d8d146b0427253a80d1ad3739d976bef95bf43fbee151b59fb3810d75450cfb3f3dbddd2a0825c9aea966b44d2c3226874fb182940a473e27873f526f2d7564b
|
data/dev.yml
CHANGED
@@ -5,7 +5,7 @@ module CI
|
|
5
5
|
attr_accessor :timeout, :worker_id, :max_requeues, :grind_count, :failure_file, :export_flaky_tests_file
|
6
6
|
attr_accessor :requeue_tolerance, :namespace, :failing_test, :statsd_endpoint
|
7
7
|
attr_accessor :max_test_duration, :max_test_duration_percentile, :track_test_duration
|
8
|
-
attr_accessor :max_test_failed, :redis_ttl
|
8
|
+
attr_accessor :max_test_failed, :redis_ttl, :warnings_file
|
9
9
|
attr_reader :circuit_breakers
|
10
10
|
attr_writer :seed, :build_id
|
11
11
|
attr_writer :queue_init_timeout, :report_timeout, :inactive_workers_timeout
|
@@ -36,7 +36,7 @@ module CI
|
|
36
36
|
grind_count: nil, max_duration: nil, failure_file: nil, max_test_duration: nil,
|
37
37
|
max_test_duration_percentile: 0.5, track_test_duration: false, max_test_failed: nil,
|
38
38
|
queue_init_timeout: nil, redis_ttl: 8 * 60 * 60, report_timeout: nil, inactive_workers_timeout: nil,
|
39
|
-
export_flaky_tests_file: nil
|
39
|
+
export_flaky_tests_file: nil, warnings_file: nil
|
40
40
|
)
|
41
41
|
@build_id = build_id
|
42
42
|
@circuit_breakers = [CircuitBreaker::Disabled]
|
@@ -61,6 +61,7 @@ module CI
|
|
61
61
|
@report_timeout = report_timeout
|
62
62
|
@inactive_workers_timeout = inactive_workers_timeout
|
63
63
|
@export_flaky_tests_file = export_flaky_tests_file
|
64
|
+
@warnings_file = warnings_file
|
64
65
|
end
|
65
66
|
|
66
67
|
def queue_init_timeout
|
data/lib/ci/queue/redis/base.rb
CHANGED
@@ -13,7 +13,12 @@ module CI
|
|
13
13
|
|
14
14
|
def initialize(redis_url, config)
|
15
15
|
@redis_url = redis_url
|
16
|
-
@redis = ::Redis.new(
|
16
|
+
@redis = ::Redis.new(
|
17
|
+
url: redis_url,
|
18
|
+
# Booting a CI worker is costly, so in case of a Redis blip,
|
19
|
+
# it makes sense to retry for a while before giving up.
|
20
|
+
reconnect_attempts: [0, 0, 0.1, 0.5, 1, 3, 5],
|
21
|
+
)
|
17
22
|
@config = config
|
18
23
|
end
|
19
24
|
|
@@ -21,6 +21,13 @@ module CI
|
|
21
21
|
redis.hkeys(key('error-reports'))
|
22
22
|
end
|
23
23
|
|
24
|
+
TOTAL_KEY = "___total___"
|
25
|
+
def requeued_tests
|
26
|
+
requeues = redis.hgetall(key('requeues-count'))
|
27
|
+
requeues.delete(TOTAL_KEY)
|
28
|
+
requeues
|
29
|
+
end
|
30
|
+
|
24
31
|
def pop_warnings
|
25
32
|
warnings = redis.multi do |transaction|
|
26
33
|
transaction.lrange(key('warnings'), 0, -1)
|
data/lib/ci/queue/redis.rb
CHANGED
data/lib/ci/queue/version.rb
CHANGED
@@ -21,11 +21,21 @@ module Minitest
|
|
21
21
|
build.flaky_reports
|
22
22
|
end
|
23
23
|
|
24
|
+
def requeued_tests
|
25
|
+
build.requeued_tests
|
26
|
+
end
|
27
|
+
|
24
28
|
def report
|
25
29
|
puts aggregates
|
26
30
|
errors = error_reports
|
27
31
|
puts errors
|
28
32
|
|
33
|
+
requeued_tests.to_a.sort.each do |test_id, count|
|
34
|
+
puts yellow("REQUEUE")
|
35
|
+
puts "#{test_id} (requeued #{count} times)"
|
36
|
+
puts ""
|
37
|
+
end
|
38
|
+
|
29
39
|
errors.empty?
|
30
40
|
end
|
31
41
|
|
@@ -230,6 +230,8 @@ module Minitest
|
|
230
230
|
msg = "#{supervisor.size} tests weren't run."
|
231
231
|
if supervisor.max_test_failed?
|
232
232
|
puts('Encountered too many failed tests. Test run was ended early.')
|
233
|
+
reporter = BuildStatusReporter.new(build: supervisor.build)
|
234
|
+
reporter.report
|
233
235
|
abort!(msg)
|
234
236
|
else
|
235
237
|
abort!(msg)
|
@@ -296,17 +298,17 @@ module Minitest
|
|
296
298
|
end
|
297
299
|
|
298
300
|
def display_warnings(build)
|
299
|
-
|
301
|
+
return unless queue_config.warnings_file
|
302
|
+
|
303
|
+
warnings = build.pop_warnings.map do |type, attributes|
|
300
304
|
case type
|
301
305
|
when CI::Queue::Warnings::RESERVED_LOST_TEST
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
"You may want to either optimize this test or bump ci-queue timeout.\n" \
|
306
|
-
"It's also possible that the worker that was processing it was terminated without being able to report back.\n"
|
307
|
-
)
|
306
|
+
"[WARNING] #{attributes[:test]} was picked up by another worker because it didn't complete in the allocated #{attributes[:timeout]} seconds.\n" \
|
307
|
+
"You may want to either optimize this test or bump ci-queue timeout.\n" \
|
308
|
+
"It's also possible that the worker that was processing it was terminated without being able to report back.\n"
|
308
309
|
end
|
309
|
-
end
|
310
|
+
end.compact
|
311
|
+
File.write(queue_config.warnings_file, warnings.join("\n"))
|
310
312
|
end
|
311
313
|
|
312
314
|
def run_tests_in_fork(queue)
|
@@ -526,6 +528,15 @@ module Minitest
|
|
526
528
|
queue_config.export_flaky_tests_file = file
|
527
529
|
end
|
528
530
|
|
531
|
+
help = <<~EOS
|
532
|
+
Defines a file where warnings during the execution are written to.
|
533
|
+
Defaults to disabled.
|
534
|
+
EOS
|
535
|
+
opts.separator ""
|
536
|
+
opts.on('--warnings-file FILE', help) do |file|
|
537
|
+
queue_config.warnings_file = file
|
538
|
+
end
|
539
|
+
|
529
540
|
help = <<~EOS
|
530
541
|
Defines after how many consecutive failures the worker will be considered unhealthy and terminate itself.
|
531
542
|
Defaults to disabled.
|
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.40.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: 2023-
|
11
|
+
date: 2023-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -239,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
239
|
- !ruby/object:Gem::Version
|
240
240
|
version: '0'
|
241
241
|
requirements: []
|
242
|
-
rubygems_version: 3.4.
|
242
|
+
rubygems_version: 3.4.22
|
243
243
|
signing_key:
|
244
244
|
specification_version: 4
|
245
245
|
summary: Distribute tests over many workers using a queue
|