knapsack_pro 3.1.1 → 3.2.0

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: 5baae9cb1ea264d73e085e9f475b4f775e06801992ffd715f33a90fc93fd974f
4
+ data.tar.gz: e74b748147d57817546675c86ea534274f65cf287e52884d3960f09aa44efbb7
5
5
  SHA512:
6
- metadata.gz: c142d923945cb4ed649535b93d0a632f5ed705513c9b3528e776784e0f6e5959ce08b81c084e69a89dd42027e453f32c2830743e8f366afe2d0fb4ddca5d8ae7
7
- data.tar.gz: 6ca8aa6ac8ad655bb267e17ba93564b5f44585b0dcaac74e195c7e818323f9aa954da067753c7c0b9b7c3782d3d3ecbf2e3829e7c147a9f054cde3af56898ad8
6
+ metadata.gz: 8f6102eef985cb8cb6c810053be5afecefcf309eb6a8367e3bcacdde09fb6bd10aa8d6ea10f68cdcdaf9b02a83117f2720ba6613562183c1ec9d52751ca87d56
7
+ data.tar.gz: b8c3d75e4267141135723fd29de4d5b97dffc1485dc762d7a9df0ba449c0827fa184261ffc101435b94678a7fc89bc8ed75876937a96d90ee6fd6103d7e38362
data/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Change Log
2
2
 
3
+ ### 3.2.0
4
+
5
+ * Add an error message to `KnapsackPro::Adapters::RspecAdapter#bind`
6
+
7
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/165
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.1.3...v3.2.0
10
+
11
+ ### 3.1.3
12
+
13
+ * Run Fallback Mode when `Errno::ECONNRESET` exception happens
14
+
15
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/164
16
+
17
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.1.2...v3.1.3
18
+
19
+ ### 3.1.2
20
+
21
+ * 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
22
+
23
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/163
24
+
25
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.1.1...v3.1.2
26
+
3
27
  ### 3.1.1
4
28
 
5
29
  * Rephrase log outputs in the Queue Mode RSpec runner
@@ -101,6 +101,11 @@ module KnapsackPro
101
101
  # In case someone is doing switch from knapsack gem to the knapsack_pro gem
102
102
  # and didn't notice the class name changed
103
103
  class RspecAdapter < RSpecAdapter
104
+ def self.bind
105
+ error_message = 'You have attempted to call KnapsackPro::Adapters::RspecAdapter.bind. Please switch to using the new class name: KnapsackPro::Adapters::RSpecAdapter. See https://docs.knapsackpro.com/knapsack_pro-ruby/guide for up-to-date configuration instructions.'
106
+ KnapsackPro.logger.error(error_message)
107
+ raise error_message
108
+ end
104
109
  end
105
110
  end
106
111
  end
@@ -119,7 +119,7 @@ module KnapsackPro
119
119
  end
120
120
 
121
121
  response_body
122
- rescue ServerError, Errno::ECONNREFUSED, Errno::ETIMEDOUT, Errno::EPIPE, EOFError, SocketError, Net::OpenTimeout, Net::ReadTimeout, OpenSSL::SSL::SSLError => e
122
+ rescue ServerError, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EPIPE, EOFError, SocketError, Net::OpenTimeout, Net::ReadTimeout, OpenSSL::SSL::SSLError => e
123
123
  logger.warn("#{action.http_method.to_s.upcase} #{endpoint_url}")
124
124
  logger.warn('Request failed due to:')
125
125
  logger.warn(e.inspect)
@@ -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.2.0'
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.2.0
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: 2022-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -405,7 +405,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
405
405
  - !ruby/object:Gem::Version
406
406
  version: '0'
407
407
  requirements: []
408
- rubygems_version: 3.2.22
408
+ rubygems_version: 3.2.32
409
409
  signing_key:
410
410
  specification_version: 4
411
411
  summary: Knapsack Pro splits tests across parallel CI nodes and ensures each parallel