ci-queue 0.71.0 → 0.73.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c6f16e56dc8a292221d29e15545c16299885c09e18a5d692aae194e16718c22
4
- data.tar.gz: 6b3e65df710c975bae6167659a68d79f3b2c0d8404410c4927b79fe25a2cc298
3
+ metadata.gz: 32e52b7283478b27a11c44576546f51f05658b891906956f6f590fa4e22a6054
4
+ data.tar.gz: 72e0ac9ee22984d0d384ca9e9c832be90ee987d237a44fc94b9ed8f7c63823fc
5
5
  SHA512:
6
- metadata.gz: 53fc80bdaf677cc7c093b07797d8ddca894ba687fd6b10ec600a8707a383ed1bb7afa90c1e6119ee1ebe8d21bc0f95202b449800e53ac9b6c8043f65a1f7c318
7
- data.tar.gz: 96f4edf81ea5fdd2de4af18d7d496b25d54c9534251dfd99863003cec89303517abd7fa12495855fad32599271ace91dfec2e08917b6db8877748fc665bb80fc
6
+ metadata.gz: c33f2ff2045bd8bd2d2b8a3b5cfd00c0f230d5f0d6fe658aef7beb1eb1ef7533da7202d71a533a326a9c5ba629016e7b42cf3f1ceed8f5d8c0eda621e9794d94
7
+ data.tar.gz: 9271a7d77dd497d1d17f4826b9e21ae7968c821dc570f0c1600803fef6fd27d8d10d1ab753abaaf7f8b2edcfcc22d2649d4075eaa11d7f90ef941f9d02bcfed6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ci-queue (0.71.0)
4
+ ci-queue (0.73.0)
5
5
  logger
6
6
 
7
7
  GEM
@@ -57,17 +57,18 @@ module CI
57
57
  end
58
58
 
59
59
  def record_error(id, payload, stats: nil)
60
- redis.pipelined do |pipeline|
60
+ acknowledged, _ = redis.pipelined do |pipeline|
61
61
  @queue.acknowledge(id, error: payload, pipeline: pipeline)
62
62
  record_stats(stats, pipeline: pipeline)
63
- @queue.increment_test_failed(pipeline: pipeline)
64
63
  end
64
+
65
+ @queue.increment_test_failed if acknowledged == 1
65
66
  nil
66
67
  end
67
68
 
68
- def record_success(id, stats: nil, skip_flaky_record: false, acknowledge: true)
69
+ def record_success(id, stats: nil, skip_flaky_record: false)
69
70
  _, error_reports_deleted_count, requeued_count, _ = redis.multi do |transaction|
70
- @queue.acknowledge(id, pipeline: transaction) if acknowledge
71
+ @queue.acknowledge(id, pipeline: transaction)
71
72
  transaction.hdel(key('error-reports'), id)
72
73
  transaction.hget(key('requeues-count'), id)
73
74
  record_stats(stats, pipeline: transaction)
@@ -76,6 +77,12 @@ module CI
76
77
  nil
77
78
  end
78
79
 
80
+ def record_requeue(id, stats: nil)
81
+ redis.pipelined do |pipeline|
82
+ record_stats(stats, pipeline: pipeline)
83
+ end
84
+ end
85
+
79
86
  def record_flaky(id, stats: nil)
80
87
  redis.pipelined do |pipeline|
81
88
  pipeline.sadd?(
@@ -5,6 +5,7 @@ local queue_key = KEYS[3]
5
5
  local zset_key = KEYS[4]
6
6
  local worker_queue_key = KEYS[5]
7
7
  local owners_key = KEYS[6]
8
+ local error_reports_key = KEYS[7]
8
9
 
9
10
  local max_requeues = tonumber(ARGV[1])
10
11
  local global_max_requeues = tonumber(ARGV[2])
@@ -32,6 +33,8 @@ end
32
33
  redis.call('hincrby', requeues_count_key, '___total___', 1)
33
34
  redis.call('hincrby', requeues_count_key, test, 1)
34
35
 
36
+ redis.call('hdel', error_reports_key, test)
37
+
35
38
  local pivot = redis.call('lrange', queue_key, -1 - offset, 0 - offset)[1]
36
39
  if pivot then
37
40
  redis.call('linsert', queue_key, 'BEFORE', pivot, test)
@@ -131,6 +131,7 @@ module CI
131
131
  key('running'),
132
132
  key('worker', worker_id, 'queue'),
133
133
  key('owners'),
134
+ key('error-reports'),
134
135
  ],
135
136
  argv: [config.max_requeues, global_max_requeues, test_key, offset],
136
137
  ) == 1
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CI
4
4
  module Queue
5
- VERSION = '0.71.0'
5
+ VERSION = '0.73.0'
6
6
  DEV_SCRIPTS_ROOT = ::File.expand_path('../../../../../redis', __FILE__)
7
7
  RELEASE_SCRIPTS_ROOT = ::File.expand_path('../redis', __FILE__)
8
8
  end
@@ -51,8 +51,10 @@ module Minitest
51
51
  stats = COUNTERS.zip(COUNTERS.map { |c| send(c) }).to_h
52
52
  if (test.failure || test.error?) && !test.skipped?
53
53
  build.record_error("#{test.klass}##{test.name}", dump(test), stats: stats)
54
+ elsif test.requeued?
55
+ build.record_requeue("#{test.klass}##{test.name}", stats: stats)
54
56
  else
55
- build.record_success("#{test.klass}##{test.name}", stats: stats, skip_flaky_record: test.skipped?, acknowledge: !test.requeued?)
57
+ build.record_success("#{test.klass}##{test.name}", stats: stats, skip_flaky_record: test.skipped?)
56
58
  end
57
59
  end
58
60
 
@@ -129,7 +129,7 @@ module Minitest
129
129
 
130
130
  puts aggregates
131
131
 
132
- if supervisor.time_left.to_i <= 0
132
+ if timed_out?
133
133
  puts red("Timed out waiting for tests to be executed.")
134
134
 
135
135
  remaining_tests = supervisor.test_ids
@@ -142,7 +142,7 @@ module Minitest
142
142
  end
143
143
 
144
144
  exit_code = TIMED_OUT_EXIT_CODE
145
- elsif supervisor.time_left_with_no_workers.to_i <= 0
145
+ elsif all_workers_died?
146
146
  puts red("All workers died.")
147
147
  exit_code = WORKERS_DIED_EXIT_CODE
148
148
  elsif supervisor.max_test_failed?
@@ -167,7 +167,11 @@ module Minitest
167
167
 
168
168
  def success?
169
169
  build.error_reports.empty? &&
170
- build.worker_errors.empty?
170
+ build.worker_errors.empty? &&
171
+ build.queue_exhausted? &&
172
+ !supervisor.max_test_failed? &&
173
+ !all_workers_died? &&
174
+ !timed_out?
171
175
  end
172
176
 
173
177
  def record(*)
@@ -220,6 +224,14 @@ module Minitest
220
224
 
221
225
  attr_reader :build, :supervisor
222
226
 
227
+ def timed_out?
228
+ supervisor.time_left.to_i <= 0
229
+ end
230
+
231
+ def all_workers_died?
232
+ supervisor.time_left_with_no_workers.to_i <= 0
233
+ end
234
+
223
235
  def aggregates
224
236
  success = failures.zero? && errors.zero?
225
237
  failures_count = "#{failures} failures, #{errors} errors,"
@@ -9,7 +9,7 @@ module Minitest
9
9
  class JUnitReporter < Minitest::Reporters::BaseReporter
10
10
  include ::CI::Queue::OutputHelpers
11
11
 
12
- def initialize(report_path = 'log/junit.xml', options = {})
12
+ def initialize(report_path = ENV.fetch("CI_QUEUE_MINITEST_JUNITXML", 'log/junit.xml'), options = {})
13
13
  super({})
14
14
  @report_path = File.absolute_path(report_path)
15
15
  @base_path = options[:base_path] || Dir.pwd
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ci-queue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.71.0
4
+ version: 0.73.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier