ci-queue 0.71.0 → 0.72.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: 2f5093c0f80a695ec2f8b30b8eb72ca58ca809a7e55aa7c0c6177a01acf7ac67
4
+ data.tar.gz: 53be96ee18a7cdec0ef60d8a367aced59c271e2db2d73c0019a30d50a62d8cce
5
5
  SHA512:
6
- metadata.gz: 53fc80bdaf677cc7c093b07797d8ddca894ba687fd6b10ec600a8707a383ed1bb7afa90c1e6119ee1ebe8d21bc0f95202b449800e53ac9b6c8043f65a1f7c318
7
- data.tar.gz: 96f4edf81ea5fdd2de4af18d7d496b25d54c9534251dfd99863003cec89303517abd7fa12495855fad32599271ace91dfec2e08917b6db8877748fc665bb80fc
6
+ metadata.gz: 3091461df678a23e28e72b5e35922a51e85aeda474f362ab94ddd49db11420c5a686eb3684313ceda2f7d725d169992ec4f76481eecbc035f6c5c494879c0d8c
7
+ data.tar.gz: aa81619322c27cc1370da7a2b3c4b9118e2fde8b8401eb13b73788a24cdddab3caab327470baa03968dba04e5b50de8fa28cd0023a8ecccd48ccd81a60f0950f
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.72.0)
5
5
  logger
6
6
 
7
7
  GEM
@@ -65,9 +65,9 @@ module CI
65
65
  nil
66
66
  end
67
67
 
68
- def record_success(id, stats: nil, skip_flaky_record: false, acknowledge: true)
68
+ def record_success(id, stats: nil, skip_flaky_record: false)
69
69
  _, error_reports_deleted_count, requeued_count, _ = redis.multi do |transaction|
70
- @queue.acknowledge(id, pipeline: transaction) if acknowledge
70
+ @queue.acknowledge(id, pipeline: transaction)
71
71
  transaction.hdel(key('error-reports'), id)
72
72
  transaction.hget(key('requeues-count'), id)
73
73
  record_stats(stats, pipeline: transaction)
@@ -76,6 +76,12 @@ module CI
76
76
  nil
77
77
  end
78
78
 
79
+ def record_requeue(id, stats: nil)
80
+ redis.pipelined do |pipeline|
81
+ record_stats(stats, pipeline: pipeline)
82
+ end
83
+ end
84
+
79
85
  def record_flaky(id, stats: nil)
80
86
  redis.pipelined do |pipeline|
81
87
  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.72.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,"
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.72.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier