knapsack_pro 3.1.1 → 3.1.2

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: 1a66b28a9f7bdfa3aaa0492c3099b62d020b2a01a48030865c503448ccb4ff77
4
- data.tar.gz: c0fae2955b72521decd338c64be57c31eacc2f33d41dbce39610be0584183aab
3
+ metadata.gz: 7970b3bcbc62109c8b7e2161e75d5b4a8337494516817dbd8c2b4929b46bbd10
4
+ data.tar.gz: 60b57c64958cb342a9b21c1dc0db32bfa70e8e105ab4680e18fd430d4148a1b7
5
5
  SHA512:
6
- metadata.gz: c142d923945cb4ed649535b93d0a632f5ed705513c9b3528e776784e0f6e5959ce08b81c084e69a89dd42027e453f32c2830743e8f366afe2d0fb4ddca5d8ae7
7
- data.tar.gz: 6ca8aa6ac8ad655bb267e17ba93564b5f44585b0dcaac74e195c7e818323f9aa954da067753c7c0b9b7c3782d3d3ecbf2e3829e7c147a9f054cde3af56898ad8
6
+ metadata.gz: 0b0a4160292a07b8ae1cc21f34c2cf0d8de1ce53d4e0501b4ba4715feb9aa51317e3f1503e3e00532d048daec816e58cd3a95dec2111fedd77f7a47206d81dcb
7
+ data.tar.gz: c083b70fb826837650d206c6f433f207cac995bbd3e6a36c386b038302bbf7b5bd90d3df201af9e8f5cdf5f68b38d4f45e1a4a7cdc0c4b9c2a533559b45cfe99
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ### 3.1.2
4
+
5
+ * Fix bug when test files have no recorded time execution then they should not be detected as slow test files for RSpec split by test examples feature
6
+
7
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/163
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.1.1...v3.1.2
10
+
3
11
  ### 3.1.1
4
12
 
5
13
  * Rephrase log outputs in the Queue Mode RSpec runner
@@ -8,7 +8,8 @@ module KnapsackPro
8
8
  time_threshold = (time_execution / KnapsackPro::Config::Env.ci_node_total) * TIME_THRESHOLD_PER_CI_NODE
9
9
 
10
10
  test_files.select do |test_file|
11
- test_file.fetch('time_execution') >= time_threshold
11
+ time_execution = test_file.fetch('time_execution')
12
+ time_execution >= time_threshold && time_execution > 0
12
13
  end
13
14
  end
14
15
 
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '3.1.1'
2
+ VERSION = '3.1.2'
3
3
  end
@@ -1,16 +1,6 @@
1
1
  describe KnapsackPro::SlowTestFileDeterminer do
2
2
  describe '.call' do
3
3
  let(:node_total) { 4 }
4
- let(:time_execution) { 20.0 }
5
- let(:test_files) do
6
- [
7
- { 'path' => 'a_spec.rb', 'time_execution' => 1.0 },
8
- { 'path' => 'b_spec.rb', 'time_execution' => 3.4 },
9
- # slow tests are above 3.5s threshold (20.0 / 4 * 0.7 = 3.5)
10
- { 'path' => 'c_spec.rb', 'time_execution' => 3.5 },
11
- { 'path' => 'd_spec.rb', 'time_execution' => 5.9 },
12
- ]
13
- end
14
4
 
15
5
  before do
16
6
  expect(KnapsackPro::Config::Env).to receive(:ci_node_total).and_return(node_total)
@@ -18,11 +8,38 @@ describe KnapsackPro::SlowTestFileDeterminer do
18
8
 
19
9
  subject { described_class.call(test_files, time_execution) }
20
10
 
21
- it do
22
- expect(subject).to eq([
23
- { 'path' => 'c_spec.rb', 'time_execution' => 3.5 },
24
- { 'path' => 'd_spec.rb', 'time_execution' => 5.9 },
25
- ])
11
+ context 'when test files have recorded time execution' do
12
+ let(:time_execution) { 20.0 }
13
+ let(:test_files) do
14
+ [
15
+ { 'path' => 'a_spec.rb', 'time_execution' => 1.0 },
16
+ { 'path' => 'b_spec.rb', 'time_execution' => 3.4 },
17
+ # slow tests are above 3.5s threshold (20.0 / 4 * 0.7 = 3.5)
18
+ { 'path' => 'c_spec.rb', 'time_execution' => 3.5 },
19
+ { 'path' => 'd_spec.rb', 'time_execution' => 5.9 },
20
+ ]
21
+ end
22
+
23
+ it do
24
+ expect(subject).to eq([
25
+ { 'path' => 'c_spec.rb', 'time_execution' => 3.5 },
26
+ { 'path' => 'd_spec.rb', 'time_execution' => 5.9 },
27
+ ])
28
+ end
29
+ end
30
+
31
+ context 'when test files have no recorded time execution' do
32
+ let(:time_execution) { 0.0 }
33
+ let(:test_files) do
34
+ [
35
+ { 'path' => 'a_spec.rb', 'time_execution' => 0.0 },
36
+ { 'path' => 'b_spec.rb', 'time_execution' => 0.0 },
37
+ ]
38
+ end
39
+
40
+ it do
41
+ expect(subject).to eq([])
42
+ end
26
43
  end
27
44
  end
28
45
 
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: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-10 00:00:00.000000000 Z
11
+ date: 2021-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake