ci-queue 0.17.0 → 0.17.1

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: 85d4db3b22fa289a9fed0d6456071f79a5e4ced83c6fc4fdee7cc4d8725df647
4
- data.tar.gz: e4635ddf545a73f4680eac9660bfd82e07962e52cc23281a7328e8c7beac6b7d
3
+ metadata.gz: 27cf10eb673c561ed2dac70e1c0d91ac026aafd331902f5e71fb278dcac953d6
4
+ data.tar.gz: 75df09bcd1018694fd49c05432a08d2904032baedce5bd24a9a07b6d46be6a28
5
5
  SHA512:
6
- metadata.gz: 79b7d97bfb440d829695c56aaf6634805098f95967afd07a52a7140c7d8b610eca8ae07029cf6e81846a51890960be4eba41e2b430f27b10a43dd426e9c3a038
7
- data.tar.gz: 199500511e7864d46d4de0a4cb8f01dab40149005137b3d8cb8ef17d7050c4a5d5c7bc2d4c088ff325a996929207a837badd5af82d5ee42136ecb342f93fa796
6
+ metadata.gz: 7bd15e57e3c5298ecfce7dc8fa881b98e2c7406ba7f43832f6746035e9fe850ff015ee5494bef13515195a4fc778ef7181fd670c0bd1ff037b6b755d26e5ac43
7
+ data.tar.gz: 642c70bc89150e8f48826b3167598f5da0cfc3eff18124331a6abbaaea9b0a6fe6295d5d131ce31afb06fbca8812a5f5fd40f406f01b61d87991a9bf862f1369
@@ -4,7 +4,7 @@ module CI
4
4
  class Configuration
5
5
  attr_accessor :timeout, :build_id, :worker_id, :max_requeues, :grind_count, :failure_file
6
6
  attr_accessor :requeue_tolerance, :namespace, :seed, :failing_test, :statsd_endpoint
7
- attr_accessor :max_test_duration, :max_test_duration_percentile
7
+ attr_accessor :max_test_duration, :max_test_duration_percentile, :track_test_duration
8
8
  attr_reader :circuit_breakers
9
9
 
10
10
  class << self
@@ -30,7 +30,7 @@ module CI
30
30
  timeout: 30, build_id: nil, worker_id: nil, max_requeues: 0, requeue_tolerance: 0,
31
31
  namespace: nil, seed: nil, flaky_tests: [], statsd_endpoint: nil, max_consecutive_failures: nil,
32
32
  grind_count: nil, max_duration: nil, failure_file: nil, max_test_duration: nil,
33
- max_test_duration_percentile: 0.5
33
+ max_test_duration_percentile: 0.5, track_test_duration: false
34
34
  )
35
35
  @circuit_breakers = [CircuitBreaker::Disabled]
36
36
  @build_id = build_id
@@ -46,6 +46,7 @@ module CI
46
46
  @worker_id = worker_id
47
47
  @max_test_duration = max_test_duration
48
48
  @max_test_duration_percentile = max_test_duration_percentile
49
+ @track_test_duration = track_test_duration
49
50
  self.max_duration = max_duration
50
51
  self.max_consecutive_failures = max_consecutive_failures
51
52
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CI
4
4
  module Queue
5
- VERSION = '0.17.0'
5
+ VERSION = '0.17.1'
6
6
  DEV_SCRIPTS_ROOT = ::File.expand_path('../../../../../redis', __FILE__)
7
7
  RELEASE_SCRIPTS_ROOT = ::File.expand_path('../redis', __FILE__)
8
8
  end
@@ -91,14 +91,18 @@ module Minitest
91
91
  queue_config.grind_count = grind_count
92
92
 
93
93
  reporter_queue = CI::Queue::Redis::Grind.new(queue_url, queue_config)
94
- test_time_record = CI::Queue::Redis::TestTimeRecord.new(queue_url, queue_config)
95
94
 
96
95
  Minitest.queue = queue
97
96
  reporters = [
98
97
  GrindRecorder.new(build: reporter_queue.build),
99
98
  TestDataReporter.new(namespace: queue_config&.namespace),
100
- TestTimeRecorder.new(build: test_time_record)
101
99
  ]
100
+
101
+ if queue_config.track_test_duration
102
+ test_time_record = CI::Queue::Redis::TestTimeRecord.new(queue_url, queue_config)
103
+ reporters << TestTimeRecorder.new(build: test_time_record)
104
+ end
105
+
102
106
  if queue_config.statsd_endpoint
103
107
  reporters << Minitest::Reporters::StatsdReporter.new(statsd_endpoint: queue_config.statsd_endpoint)
104
108
  end
@@ -205,15 +209,21 @@ module Minitest
205
209
  grind_reporter = GrindReporter.new(build: supervisor.build)
206
210
  grind_reporter.report
207
211
 
208
- test_time_record = CI::Queue::Redis::TestTimeRecord.new(queue_url, queue_config)
209
- test_time_reporter = Minitest::Queue::TestTimeReporter.new(
210
- build: test_time_record,
211
- limit: queue_config.max_test_duration,
212
- percentile: queue_config.max_test_duration_percentile,
213
- )
214
- test_time_reporter.report
212
+ test_time_reporter_success = if queue_config.track_test_duration
213
+ test_time_record = CI::Queue::Redis::TestTimeRecord.new(queue_url, queue_config)
214
+ test_time_reporter = Minitest::Queue::TestTimeReporter.new(
215
+ build: test_time_record,
216
+ limit: queue_config.max_test_duration,
217
+ percentile: queue_config.max_test_duration_percentile,
218
+ )
219
+ test_time_reporter.report
220
+
221
+ test_time_reporter.success?
222
+ else
223
+ true
224
+ end
215
225
 
216
- exit! grind_reporter.success? && test_time_reporter.success? ? 0 : 1
226
+ exit! grind_reporter.success? && test_time_reporter_success ? 0 : 1
217
227
  end
218
228
 
219
229
  private
@@ -416,6 +426,13 @@ module Minitest
416
426
  queue_config.max_consecutive_failures = max
417
427
  end
418
428
 
429
+ help = <<~EOS
430
+ Must set this option in report and report_grind command if you set --max-test-duration in the report_grind
431
+ EOS
432
+ opts.on('--track-test-duration', help) do
433
+ queue_config.track_test_duration = true
434
+ end
435
+
419
436
  help = <<~EOS
420
437
  Set the time limit of the execution time from grinds on a given test.
421
438
  For example, when max-test-duration is set to 10 and
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.17.0
4
+ version: 0.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-06 00:00:00.000000000 Z
11
+ date: 2020-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ansi