ci-queue 0.70.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: c364b5557e5b1f4aa031dc23c32afab326e6bda9e3533ee80863682df5ff477c
4
- data.tar.gz: cc23906ce01e11a44af734ccb17ba4d566227a3e165d133edf908b20086bb8d7
3
+ metadata.gz: 2f5093c0f80a695ec2f8b30b8eb72ca58ca809a7e55aa7c0c6177a01acf7ac67
4
+ data.tar.gz: 53be96ee18a7cdec0ef60d8a367aced59c271e2db2d73c0019a30d50a62d8cce
5
5
  SHA512:
6
- metadata.gz: 2afc0d0c176bb567e08302ba8ffc5adffe7466f1690d9864be8c50774f19b1ff8b188b9c3cd0665edb0bdddda9a14e48385c22917595c73e02811a9108ff5625
7
- data.tar.gz: '086ded1dd94886983620519b535522d959d2e3850c50157592d85f4853a3bd7d4f029324d6b81859a4fbb448cae1045ba33795ae1a6d51d9508c91d77f71a0a9'
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.70.0)
4
+ ci-queue (0.72.0)
5
5
  logger
6
6
 
7
7
  GEM
@@ -56,8 +56,6 @@ module CI
56
56
  redis.rpush(key('warnings'), Marshal.dump([type, attributes]))
57
57
  end
58
58
 
59
- Test = Struct.new(:id) # Hack
60
-
61
59
  def record_error(id, payload, stats: nil)
62
60
  redis.pipelined do |pipeline|
63
61
  @queue.acknowledge(id, error: payload, pipeline: pipeline)
@@ -67,17 +65,23 @@ module CI
67
65
  nil
68
66
  end
69
67
 
70
- def record_success(id, stats: nil, skip_flaky_record: false, acknowledge: true)
71
- @queue.acknowledge(id) if acknowledge
72
- error_reports_deleted_count, requeued_count, _ = redis.pipelined do |pipeline|
73
- pipeline.hdel(key('error-reports'), id)
74
- pipeline.hget(key('requeues-count'), id)
75
- record_stats(stats, pipeline: pipeline)
68
+ def record_success(id, stats: nil, skip_flaky_record: false)
69
+ _, error_reports_deleted_count, requeued_count, _ = redis.multi do |transaction|
70
+ @queue.acknowledge(id, pipeline: transaction)
71
+ transaction.hdel(key('error-reports'), id)
72
+ transaction.hget(key('requeues-count'), id)
73
+ record_stats(stats, pipeline: transaction)
76
74
  end
77
75
  record_flaky(id) if !skip_flaky_record && (error_reports_deleted_count.to_i > 0 || requeued_count.to_i > 0)
78
76
  nil
79
77
  end
80
78
 
79
+ def record_requeue(id, stats: nil)
80
+ redis.pipelined do |pipeline|
81
+ record_stats(stats, pipeline: pipeline)
82
+ end
83
+ end
84
+
81
85
  def record_flaky(id, stats: nil)
82
86
  redis.pipelined do |pipeline|
83
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.70.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.70.0
4
+ version: 0.72.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier