ci-queue 0.20.9 → 0.21.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: ce180525dfe099a326292c007d5654789406e1a4af4ed74455ea036891fd5e3b
4
- data.tar.gz: 570f697ebc2d320e3a556b0b7323d8a2cc9920e3263e07ebef8fa2fc3517500e
3
+ metadata.gz: a9a1d5f8211c29b9993d6ef94acff329a040d7e940b28e8d51eedc01e87c106b
4
+ data.tar.gz: d584ef67d1f2036b4c8b7880099515ff2a4f0618c2813e9caee099cfe11e587f
5
5
  SHA512:
6
- metadata.gz: abe9a5431c9e61435f8f93ede21eae622c000b27d2359d24171e3e0bc10562d6b9c87f10138ccbd3d12e149aec09601ba2007510e1e629b1564df43a05675ce2
7
- data.tar.gz: d504aa4e467eba720a2aaa35bb448dbbf13d52502d6e16a491afcfbfa8413face59eefc5b260c5412889b3d7dc0e65c194569e676e6f656147a163e67f622394
6
+ metadata.gz: 88ddaa2717da8b9a989fa6d7bf859d509c29d2cf19ade4fcab882f6dfe4b33e1969c5f89121f3b5dfb1439b03e89e41227cf9f9f8e33d7e9295e43c7a2cb8e51
7
+ data.tar.gz: e7f5753cd1bdfd0f7500ebe00be9e7caf3a342ae931b974971bc95aa8ab27e86744211036a4fe70420a80d374235e1eb1ea6ce6eee4e14da52560502f1c26413
@@ -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
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CI
4
4
  module Queue
5
- VERSION = '0.20.9'
5
+ VERSION = '0.21.0'
6
6
  DEV_SCRIPTS_ROOT = ::File.expand_path('../../../../../redis', __FILE__)
7
7
  RELEASE_SCRIPTS_ROOT = ::File.expand_path('../redis', __FILE__)
8
8
  end
@@ -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
@@ -107,6 +115,8 @@ module Minitest
107
115
  test_retried: test_retried,
108
116
  test_assertions: test_assertions,
109
117
  test_duration: test_duration,
118
+ test_start_timestamp: test_start_timestamp,
119
+ test_finish_timestamp: test_finish_timestamp,
110
120
  test_file_path: test_file_path,
111
121
  test_file_line_number: test_file_line_number,
112
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,13 +163,30 @@ 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
+ result.start_timestamp = start_timestamp
172
+ result.finish_timestamp = current_timestamp
173
+ end
174
+
162
175
  def run
163
- Minitest.run_one_method(@runnable, @method_name)
176
+ with_timestamps do
177
+ Minitest.run_one_method(@runnable, @method_name)
178
+ end
164
179
  end
165
180
 
166
181
  def flaky?
167
182
  Minitest.queue.flaky?(self)
168
183
  end
184
+
185
+ private
186
+
187
+ def current_timestamp
188
+ Time.now.to_i
189
+ end
169
190
  end
170
191
 
171
192
  attr_reader :queue
@@ -244,9 +265,11 @@ MiniTest.singleton_class.prepend(MiniTest::Queue)
244
265
  if defined? MiniTest::Result
245
266
  MiniTest::Result.prepend(MiniTest::Requeueing)
246
267
  MiniTest::Result.prepend(MiniTest::Flakiness)
268
+ MiniTest::Result.prepend(MiniTest::WithTimestamps)
247
269
  else
248
270
  MiniTest::Test.prepend(MiniTest::Requeueing)
249
271
  MiniTest::Test.prepend(MiniTest::Flakiness)
272
+ MiniTest::Test.prepend(MiniTest::WithTimestamps)
250
273
 
251
274
  module MinitestBackwardCompatibility
252
275
  def source_location
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.9
4
+ version: 0.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-14 00:00:00.000000000 Z
11
+ date: 2021-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler