ci-queue 0.20.7 → 0.21.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: 869f4269443defdf645936cf4b6cf969dd821263b9a96b4de71da7bbbbd98152
4
- data.tar.gz: 3aa8a19f472ed869a88f35b3c124a01700fc1acf235617c5f78dcb67232f91c8
3
+ metadata.gz: bb09b44ca70cde6218873faed3b7067295088a115b2b33ddc93b3853ad318042
4
+ data.tar.gz: d0eb4a637fb89aa8c2858e5f1c363b86518cb310729d417fc6e7847c7bd261b8
5
5
  SHA512:
6
- metadata.gz: 7d5cd85fe45b05060738a72f6be624e3cfef6bf9a24ea3019433773aa7bb8a7a6f5ef94dc6a0d2cce5a2d04d4b820ca242f41f07e8720aa2f004f528bc4de372
7
- data.tar.gz: a82a023c73718e924210c2a379d6195b62062731679c24c6a230cff26df3d455107c1a902d8a9a97fd3a2a2510a6c145e8f02545121720139ad2e2802d37b3ae
6
+ metadata.gz: e3b35848df951df70cddc2bab778f5160dc0293f09cc66218b31567ce8b2fe7e7a020f5aeec9fb2b6890e53a175b70ada164b404306ee5582cc1a40601515643
7
+ data.tar.gz: 8f5ffdaaad075ddcc724117f3b2414f7a15b49509d0b0df5b4415827b6452efc251974398a58b2203c776fdb70819ab53c8042ce4d3add056b245ff8cafed179
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require 'ci/queue/static'
3
+ require 'set'
3
4
 
4
5
  module CI
5
6
  module Queue
@@ -15,7 +16,6 @@ module CI
15
16
  attr_reader :total
16
17
 
17
18
  def initialize(redis, config)
18
- @last_warning = nil
19
19
  @reserved_test = nil
20
20
  @shutdown_required = false
21
21
  super(redis, config)
@@ -48,7 +48,7 @@ module CI
48
48
  wait_for_master
49
49
  until shutdown_required? || config.circuit_breakers.any?(&:open?) || exhausted? || max_test_failed?
50
50
  if test = reserve
51
- yield index.fetch(test), @last_warning
51
+ yield index.fetch(test)
52
52
  else
53
53
  sleep 0.05
54
54
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CI
4
4
  module Queue
5
- VERSION = '0.20.7'
5
+ VERSION = '0.21.1'
6
6
  DEV_SCRIPTS_ROOT = ::File.expand_path('../../../../../redis', __FILE__)
7
7
  RELEASE_SCRIPTS_ROOT = ::File.expand_path('../redis', __FILE__)
8
8
  end
@@ -7,6 +7,8 @@ require 'fileutils'
7
7
  module Minitest
8
8
  module Queue
9
9
  class JUnitReporter < Minitest::Reporters::BaseReporter
10
+ include ::CI::Queue::OutputHelpers
11
+
10
12
  def initialize(report_path = 'log/junit.xml', options = {})
11
13
  super({})
12
14
  @report_path = File.absolute_path(report_path)
@@ -76,6 +78,8 @@ module Minitest
76
78
 
77
79
  testcase = testsuite.add_element('testcase', attributes)
78
80
  add_xml_message_for(testcase, test) unless test.passed?
81
+ rescue REXML::ParseException, RuntimeError => error
82
+ step(red("Skipping adding '#{suite}##{test.name}' to JUnit report: #{error.message}"))
79
83
  end
80
84
  end
81
85
 
@@ -52,6 +52,14 @@ module Minitest
52
52
  @test.time
53
53
  end
54
54
 
55
+ def test_start_timestamp
56
+ @test.start_timestamp
57
+ end
58
+
59
+ def test_finish_timestamp
60
+ @test.finish_timestamp
61
+ end
62
+
55
63
  def test_file_path
56
64
  path = @test.source_location.first
57
65
  begin
@@ -82,7 +90,11 @@ module Minitest
82
90
  return nil unless @test.failure
83
91
 
84
92
  path = error_location(@test.failure).first
85
- relative_path_for(path)
93
+ begin
94
+ relative_path_for(path)
95
+ rescue ArgumentError
96
+ path # e.g. "(eval)" etc.
97
+ end
86
98
  end
87
99
 
88
100
  def error_file_number
@@ -103,6 +115,8 @@ module Minitest
103
115
  test_retried: test_retried,
104
116
  test_assertions: test_assertions,
105
117
  test_duration: test_duration,
118
+ test_start_timestamp: test_start_timestamp,
119
+ test_finish_timestamp: test_finish_timestamp,
106
120
  test_file_path: test_file_path,
107
121
  test_file_line_number: test_file_line_number,
108
122
  error_class: error_class,
@@ -102,6 +102,10 @@ module Minitest
102
102
  end
103
103
  end
104
104
 
105
+ module WithTimestamps
106
+ attr_accessor :start_timestamp, :finish_timestamp
107
+ end
108
+
105
109
  module Queue
106
110
  attr_writer :run_command_formatter, :project_root
107
111
 
@@ -159,21 +163,36 @@ module Minitest
159
163
  id <=> other.id
160
164
  end
161
165
 
166
+ def with_timestamps
167
+ start_timestamp = current_timestamp
168
+ result = yield
169
+ result
170
+ ensure
171
+ if result
172
+ result.start_timestamp = start_timestamp
173
+ result.finish_timestamp = current_timestamp
174
+ end
175
+ end
176
+
162
177
  def run
163
- Minitest.run_one_method(@runnable, @method_name)
178
+ with_timestamps do
179
+ Minitest.run_one_method(@runnable, @method_name)
180
+ end
164
181
  end
165
182
 
166
183
  def flaky?
167
184
  Minitest.queue.flaky?(self)
168
185
  end
169
- end
170
186
 
171
- attr_reader :queue
187
+ private
172
188
 
173
- def queue=(queue)
174
- @queue = queue
189
+ def current_timestamp
190
+ Time.now.to_i
191
+ end
175
192
  end
176
193
 
194
+ attr_accessor :queue
195
+
177
196
  def queue_reporters=(reporters)
178
197
  @queue_reporters ||= []
179
198
  Reporters.use!(((Reporters.reporters || []) - @queue_reporters) + reporters)
@@ -244,9 +263,11 @@ MiniTest.singleton_class.prepend(MiniTest::Queue)
244
263
  if defined? MiniTest::Result
245
264
  MiniTest::Result.prepend(MiniTest::Requeueing)
246
265
  MiniTest::Result.prepend(MiniTest::Flakiness)
266
+ MiniTest::Result.prepend(MiniTest::WithTimestamps)
247
267
  else
248
268
  MiniTest::Test.prepend(MiniTest::Requeueing)
249
269
  MiniTest::Test.prepend(MiniTest::Flakiness)
270
+ MiniTest::Test.prepend(MiniTest::WithTimestamps)
250
271
 
251
272
  module MinitestBackwardCompatibility
252
273
  def source_location
data/lib/rspec/queue.rb CHANGED
@@ -112,7 +112,7 @@ module RSpec
112
112
 
113
113
  help = <<~EOS
114
114
  Specify a timeout after which if a test haven't completed, it will be picked up by another worker.
115
- It is very important to set this vlaue higher than the slowest test in the suite, otherwise performance will be impacted.
115
+ It is very important to set this value higher than the slowest test in the suite, otherwise performance will be impacted.
116
116
  Defaults to 30 seconds.
117
117
  EOS
118
118
  parser.separator ""
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.20.7
4
+ version: 0.21.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-11-20 00:00:00.000000000 Z
11
+ date: 2021-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -238,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
238
238
  - !ruby/object:Gem::Version
239
239
  version: '0'
240
240
  requirements: []
241
- rubygems_version: 3.0.3
241
+ rubygems_version: 3.2.20
242
242
  signing_key:
243
243
  specification_version: 4
244
244
  summary: Distribute tests over many workers using a queue