knapsack_pro 7.6.0 → 7.6.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: 4c20774d9ffe521fc4a3a137558b47c79cc27b085e96f2b00d3a61711e43f0c9
4
- data.tar.gz: af712f88ca12cf15de791d3b755fc75d6a527e938034d835ddaa0e07b77a5fd2
3
+ metadata.gz: 11356d7eace33ba43c1dec527436091c103ac8b5d6c9bd2ae28851294854d4df
4
+ data.tar.gz: 15717cbb12d7d9143be84504464ecd32a25841bb984e70ec88ec6b3c05b0dcbe
5
5
  SHA512:
6
- metadata.gz: ad574926a94e992932fbc8538d15040535624631c22f3679ca3c39d4d304f2e87b0efa30c536eb2695698b419b3f9e58708f1e4e5afc83d6df565e4eae6c3e7b
7
- data.tar.gz: 21365b7b89c96193c3ad9ae45657d6916760745b584f1552a7e85ac686b2de6e12d6b7203c8847e2cd09997b456462f742490cc4d140d42cf135ddbd5cc23865
6
+ metadata.gz: 5a12e300c1a6a7427836b2a62d71b7ccb35174c31d444ac77fdd19847a7b9b85fc805adb9bd966329d0c7e21e58c233230e63e8943b14bad6b9267236c69ee3a
7
+ data.tar.gz: 3ac187d311a35d343c5c6fd86c667049642638862d5dff4d68ecff91d63191b05a1206881d24efebd3163d92cbd69e08bd8d0a4b129f69bf45b348dde49662be
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ### UNRELEASED
4
4
 
5
+ ### 7.6.1
6
+
7
+ * Add support for the Timecop 0.9.9 gem version so that we could track proper tests' execution time when `Process.clock_gettime` is mocked.
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/262
10
+
11
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v7.6.0...v7.6.1
12
+
5
13
  ### 7.6.0
6
14
 
7
15
  * Avoid starting an unnecessary process in Queue Mode.
data/knapsack_pro.gemspec CHANGED
@@ -38,5 +38,5 @@ Gem::Specification.new do |spec|
38
38
  spec.add_development_dependency 'pry', '~> 0'
39
39
  spec.add_development_dependency 'vcr', '>= 6.0'
40
40
  spec.add_development_dependency 'webmock', '>= 3.13'
41
- spec.add_development_dependency 'timecop', '>= 0.9.4'
41
+ spec.add_development_dependency 'timecop', '>= 0.9.9'
42
42
  end
@@ -145,7 +145,7 @@ module KnapsackPro
145
145
  end
146
146
 
147
147
  def now
148
- Process.clock_gettime(Process::CLOCK_MONOTONIC)
148
+ KnapsackPro::Utils.time_now
149
149
  end
150
150
  end
151
151
  end
@@ -155,7 +155,7 @@ module KnapsackPro
155
155
  end
156
156
 
157
157
  def now_without_mock_time
158
- Process.clock_gettime(Process::CLOCK_MONOTONIC)
158
+ KnapsackPro::Utils.time_now
159
159
  end
160
160
  end
161
161
  end
@@ -5,5 +5,13 @@ module KnapsackPro
5
5
  def self.unsymbolize(obj)
6
6
  JSON.parse(obj.to_json)
7
7
  end
8
+
9
+ def self.time_now
10
+ if defined?(Timecop) && Process.respond_to?(:clock_gettime_without_mock)
11
+ Process.clock_gettime_without_mock(Process::CLOCK_MONOTONIC)
12
+ else
13
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
14
+ end
15
+ end
8
16
  end
9
17
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KnapsackPro
4
- VERSION = '7.6.0'
4
+ VERSION = '7.6.1'
5
5
  end
@@ -16,4 +16,40 @@ describe KnapsackPro::Utils do
16
16
  ])
17
17
  end
18
18
  end
19
+
20
+ describe '.time_now' do
21
+ subject { described_class.time_now }
22
+
23
+ context 'when Timecop does not mock the time' do
24
+ it do
25
+ now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
26
+ expect(subject).to be_within(0.001).of(now)
27
+ end
28
+ end
29
+
30
+ context 'when Timecop does mock the process clock' do
31
+ around(:example) do |ex|
32
+ unless Gem::Version.new(Timecop::VERSION) >= Gem::Version.new('0.9.9')
33
+ raise 'Timecop >= 0.9.9 is required to run this test. Please run: bundle update'
34
+ end
35
+
36
+ if Gem::Version.new(Timecop::VERSION) >= Gem::Version.new('0.9.10')
37
+ Timecop.mock_process_clock = true
38
+ ex.run
39
+ Timecop.mock_process_clock = false
40
+ else
41
+ ex.run
42
+ end
43
+ end
44
+
45
+ it do
46
+ now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
47
+
48
+ time = Time.local(2020, 1, 31)
49
+ Timecop.travel(time) do
50
+ expect(subject).to be_within(0.001).of(now)
51
+ end
52
+ end
53
+ end
54
+ end
19
55
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knapsack_pro
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.6.0
4
+ version: 7.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-12 00:00:00.000000000 Z
11
+ date: 2024-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - ">="
172
172
  - !ruby/object:Gem::Version
173
- version: 0.9.4
173
+ version: 0.9.9
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
- version: 0.9.4
180
+ version: 0.9.9
181
181
  description: Knapsack Pro wraps your current test runner(s) and works with your existing
182
182
  CI infrastructure to parallelize tests optimally. It dynamically splits your tests
183
183
  based on up-to-date test execution data. It's designed from the ground up for CI