knapsack_pro 3.1.2 → 3.2.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: 7970b3bcbc62109c8b7e2161e75d5b4a8337494516817dbd8c2b4929b46bbd10
4
- data.tar.gz: 60b57c64958cb342a9b21c1dc0db32bfa70e8e105ab4680e18fd430d4148a1b7
3
+ metadata.gz: d589b843abc560c3c17965cbda829fe472bb8eda866d090403c83157736b0246
4
+ data.tar.gz: 237764ce934370152bc6372f735d42f4fb0e660d0a555b99fd51842561f835e8
5
5
  SHA512:
6
- metadata.gz: 0b0a4160292a07b8ae1cc21f34c2cf0d8de1ce53d4e0501b4ba4715feb9aa51317e3f1503e3e00532d048daec816e58cd3a95dec2111fedd77f7a47206d81dcb
7
- data.tar.gz: c083b70fb826837650d206c6f433f207cac995bbd3e6a36c386b038302bbf7b5bd90d3df201af9e8f5cdf5f68b38d4f45e1a4a7cdc0c4b9c2a533559b45cfe99
6
+ metadata.gz: 88a10b32de62fcc1e20ac7dbb1bb46a29dfa6072c188d396e4a772171b7667d105d61742b6f6a65af32125474566cf1d0108031fbf433bef4b54145995a3d615
7
+ data.tar.gz: c3ade290ea5d7080a0fa9185ef75c5e180e85b4d9224c251198d722564330543e7c445e00eb4b2c77270345f8d2af78157565f076e25194ab22c6bc8af5fa802
data/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Change Log
2
2
 
3
+ ### 3.2.1
4
+
5
+ * Raise exception when using `:focus` tag to avoid skipping RSpec tests
6
+
7
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/167
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.2.0...v3.2.1
10
+
11
+ ### 3.2.0
12
+
13
+ * Add an error message to `KnapsackPro::Adapters::RspecAdapter#bind`
14
+
15
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/165
16
+
17
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.1.3...v3.2.0
18
+
19
+ ### 3.1.3
20
+
21
+ * Run Fallback Mode when `Errno::ECONNRESET` exception happens
22
+
23
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/164
24
+
25
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.1.2...v3.1.3
26
+
3
27
  ### 3.1.2
4
28
 
5
29
  * 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
@@ -62,6 +62,10 @@ module KnapsackPro
62
62
  current_test_path
63
63
  end
64
64
 
65
+ if example.metadata[:focus] && KnapsackPro::Adapters::RSpecAdapter.rspec_configuration.filter.rules[:focus]
66
+ raise "We detected a test file path #{current_test_path} with a test using the metadata `:focus` tag. RSpec might not run some tests in the Queue Mode (causing random tests skipping problem). Please remove the `:focus` tag from your codebase. See more: https://knapsackpro.com/faq/question/rspec-is-not-running-some-tests"
67
+ end
68
+
65
69
  example.run
66
70
  end
67
71
 
@@ -95,12 +99,25 @@ module KnapsackPro
95
99
  end
96
100
  end
97
101
  end
102
+
103
+ private
104
+
105
+ # Hide RSpec configuration so that we could mock it in the spec.
106
+ # Mocking existing RSpec configuration could impact test's runtime.
107
+ def self.rspec_configuration
108
+ ::RSpec.configuration
109
+ end
98
110
  end
99
111
 
100
112
  # This is added to provide backwards compatibility
101
113
  # In case someone is doing switch from knapsack gem to the knapsack_pro gem
102
114
  # and didn't notice the class name changed
103
115
  class RspecAdapter < RSpecAdapter
116
+ def self.bind
117
+ 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.'
118
+ KnapsackPro.logger.error(error_message)
119
+ raise error_message
120
+ end
104
121
  end
105
122
  end
106
123
  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)
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '3.1.2'
2
+ VERSION = '3.2.1'
3
3
  end
@@ -175,7 +175,35 @@ describe KnapsackPro::Adapters::RSpecAdapter do
175
175
  let(:logger) { instance_double(Logger) }
176
176
  let(:global_time) { 'Global time: 01m 05s' }
177
177
  let(:test_path) { 'spec/a_spec.rb' }
178
- let(:current_example) { double }
178
+ let(:current_example) { double(metadata: {}) }
179
+
180
+ context "when the example's metadata has :focus tag AND RSpec inclusion rule includes :focus" do
181
+ let(:current_example) { double(metadata: { focus: true }) }
182
+
183
+ it do
184
+ expect(KnapsackPro::Config::Env).to receive(:rspec_split_by_test_examples?).and_return(false)
185
+
186
+ expect(config).to receive(:prepend_before).with(:context).and_yield
187
+
188
+ allow(KnapsackPro).to receive(:tracker).and_return(tracker)
189
+ expect(tracker).to receive(:start_timer).ordered
190
+
191
+ expect(config).to receive(:around).with(:each).and_yield(current_example)
192
+ expect(::RSpec).to receive(:configure).and_yield(config)
193
+
194
+ expect(tracker).to receive(:stop_timer).ordered
195
+
196
+ expect(described_class).to receive(:test_path).with(current_example).and_return(test_path)
197
+
198
+ expect(tracker).to receive(:current_test_path=).with(test_path).ordered
199
+
200
+ expect(described_class).to receive_message_chain(:rspec_configuration, :filter, :rules, :[]).with(:focus).and_return(true)
201
+
202
+ expect {
203
+ subject.bind_time_tracker
204
+ }.to raise_error /We detected a test file path spec\/a_spec\.rb with a test using the metadata `:focus` tag/
205
+ end
206
+ end
179
207
 
180
208
  context 'when rspec split by test examples is disabled' do
181
209
  before do
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.2
4
+ version: 3.2.1
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-28 00:00:00.000000000 Z
11
+ date: 2022-03-24 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