ci-queue 0.39.0 → 0.40.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b107915399e844aa0692d7734747517860631865a6552d4ef3ca4ca8e4be70c5
4
- data.tar.gz: ab35800b2df6a59fec8f6af18e3ab6240cc09818bad1de8fcb23f344541455fc
3
+ metadata.gz: be4adb99c549118b56b3b989e226acd24276f2105cd407ebe7c60685b439712f
4
+ data.tar.gz: 53ad2297734965e9eb942710e6c6e0dcff81b2597d864f1c0336cbf88c5b792d
5
5
  SHA512:
6
- metadata.gz: 53a25b74ed491b2a1d62b8579f2416c7376ba1eaad0831bbb09a45a145177d68e4ac3b86de971e1645cdbabe74d1405109cc325e25932a130099f0996a0058c9
7
- data.tar.gz: 499841246ebd2364397b54a068c033d90b0a5aa670e116678e51002af0eb3c6664bd4585b4e40c841714a2eb969d388707ae8b6a12db60d4ed22269c08c7aa85
6
+ metadata.gz: c5748d3f7cb1b9a9dd9cd386394c6e812f900fe7883686e920b8d2375fbb4fbfaf6c1a1a78703866f1bc3a64bf704cb21188c9fe3b1ddf762490aa1a36344770
7
+ data.tar.gz: d8d146b0427253a80d1ad3739d976bef95bf43fbee151b59fb3810d75450cfb3f3dbddd2a0825c9aea966b44d2c3226874fb182940a473e27873f526f2d7564b
data/dev.yml CHANGED
@@ -3,7 +3,7 @@
3
3
  name: ci-queue
4
4
 
5
5
  up:
6
- - ruby: 2.6.5
6
+ - ruby: 3.2.0
7
7
  - bundler
8
8
  - redis
9
9
 
@@ -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
@@ -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)
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CI
4
4
  module Queue
5
- VERSION = '0.39.0'
5
+ VERSION = '0.40.0'
6
6
  DEV_SCRIPTS_ROOT = ::File.expand_path('../../../../../redis', __FILE__)
7
7
  RELEASE_SCRIPTS_ROOT = ::File.expand_path('../redis', __FILE__)
8
8
  end
@@ -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
- build.pop_warnings.each do |type, attributes|
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
- puts reopen_previous_step
303
- puts yellow(
304
- "[WARNING] #{attributes[:test]} was picked up by another worker because it didn't complete in the allocated #{attributes[:timeout]} seconds.\n" \
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.39.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-12-11 00:00:00.000000000 Z
11
+ date: 2023-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler