knapsack_pro 2.4.0 → 2.9.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: be2eb19b6bc60ed03791ae1fd85b0893d85a42f96be0a584f7774174572e4982
4
- data.tar.gz: e500f47322535c432f3cc89eed024708cf5e9e66162cecf3af5e6793d90a6794
3
+ metadata.gz: 7985606018ab50713321190176606a281cdfbec98e7c4883569ddcc73fd1acad
4
+ data.tar.gz: e1564d27e3a6ab282657d131e0ccd134de831260cf240114cca213b32c804e27
5
5
  SHA512:
6
- metadata.gz: 2303b72bfe98c25b1b7ec464f0632ce80ae20233457d990c0f92755fff63173bfad4da9dd2f9dc12873892c5157919cdd618d9b3999bef82f46242758bbc18b7
7
- data.tar.gz: f3f49a0618a13876aaec016e3458a673a4a1ce7a6fb168f8f44409c10d00791a8e2e8c4c542f6c015951d4bcb17c2052e613dcbba69cf898f1d653818ce3eca1
6
+ metadata.gz: 658af58fa87cff47e1c61cd48bc37a54574339a5450fe0cc77c8dac0001cdd0fad36ed0537fdb597ab23678c99446fcbf6793f574ee7ad99c12d05ee7be7a25f
7
+ data.tar.gz: 6ef3927c8ea007073102969878dea4c00cc3340912d49448803e4b62207e73fd289e6dcfb7a22b22eab4d21f9c72828933bfdccf0d509a2e904fda425e73cdcb
@@ -1,5 +1,45 @@
1
1
  # Change Log
2
2
 
3
+ ### 2.9.0
4
+
5
+ * Use `Process.clock_gettime` to measure track execution time
6
+
7
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/132
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v2.8.0...v2.9.0
10
+
11
+ ### 2.8.0
12
+
13
+ * More actionable error message when RSpec split by examples is not working due to RSpec dry-run failure
14
+
15
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/130
16
+
17
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v2.7.0...v2.8.0
18
+
19
+ ### 2.7.0
20
+
21
+ * Add support for env var `KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE` to allow accepting file containing test files to run
22
+
23
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/129
24
+
25
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v2.6.0...v2.7.0
26
+
27
+ ### 2.6.0
28
+
29
+ * Improve logger to show failed requests URL and when retry will happen
30
+
31
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/127
32
+
33
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v2.5.0...v2.6.0
34
+
35
+ ### 2.5.0
36
+
37
+ * Add production branch to non encryptable branches names
38
+
39
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/126
40
+
41
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v2.4.0...v2.5.0
42
+
3
43
  ### 2.4.0
4
44
 
5
45
  * Update list of non encryptable branches
data/README.md CHANGED
@@ -3082,7 +3082,9 @@ The test file pattern and exclude pattern support any glob pattern handled by [`
3082
3082
 
3083
3083
  #### How to run a specific list of test files or only some tests from test file?
3084
3084
 
3085
- :information_source: If you don't want to use the pattern [`KNAPSACK_PRO_TEST_FILE_PATTERN`](#how-can-i-run-tests-from-multiple-directories) to define a list of tests to run then read below.
3085
+ :information_source: If you don't want to use the pattern [`KNAPSACK_PRO_TEST_FILE_PATTERN`](#how-can-i-run-tests-from-multiple-directories) to define a list of tests to run then read below two options.
3086
+
3087
+ **Option 1:**
3086
3088
 
3087
3089
  If you want to run a specific list of test files that are explicitly defined by you or auto-generated by some kind of script you created then please use:
3088
3090
 
@@ -3090,7 +3092,24 @@ If you want to run a specific list of test files that are explicitly defined by
3090
3092
 
3091
3093
  Note `KNAPSACK_PRO_TEST_FILE_LIST` must be a list of test files comma separated. You can provide line number for tests inside of spec file in case of RSpec (this way you can run only one test or a group of tests from RSpec spec file). You can provide the same file a few times with different test line number.
3092
3094
 
3093
- Note when you set `KNAPSACK_PRO_TEST_FILE_LIST` then below environment variables are ignored:
3095
+ **Option 2:**
3096
+
3097
+ Similarly, you can also provide a source file containing the test files that you would like to run. For example:
3098
+ `KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE=spec/fixtures/test_file_list_source_file.txt`
3099
+ And the content of the source file can be any of the format below:
3100
+
3101
+ ```
3102
+ ./spec/test1_spec.rb
3103
+ spec/test2_spec.rb[1]
3104
+ ./spec/test3_spec.rb[1:2:3:4]
3105
+ ./spec/test4_spec.rb:4
3106
+ ./spec/test4_spec.rb:5
3107
+ ```
3108
+
3109
+ > Note that each of the line must be ending with `\n` the new line.
3110
+
3111
+ Note when you set `KNAPSACK_PRO_TEST_FILE_LIST` or `KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE` then below environment variables are ignored:
3112
+
3094
3113
  * `KNAPSACK_PRO_TEST_FILE_PATTERN`
3095
3114
  * `KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN`
3096
3115
 
@@ -3258,6 +3277,8 @@ $ gem build knapsack_pro.gemspec
3258
3277
  $ gem push knapsack_pro-X.X.X.gem
3259
3278
  ```
3260
3279
 
3280
+ Update the latest available gem version in `TestSuiteClientVersionChecker` for the Knapsack Pro API repository.
3281
+
3261
3282
  ## Mentions
3262
3283
 
3263
3284
  List of articles where people mentioned Knapsack Pro:
@@ -115,14 +115,19 @@ module KnapsackPro
115
115
 
116
116
  response_body
117
117
  rescue ServerError, Errno::ECONNREFUSED, Errno::ETIMEDOUT, Errno::EPIPE, EOFError, SocketError, Net::OpenTimeout, Net::ReadTimeout, OpenSSL::SSL::SSLError => e
118
+ logger.warn("#{action.http_method.to_s.upcase} #{endpoint_url}")
119
+ logger.warn('Request failed due to:')
118
120
  logger.warn(e.inspect)
119
121
  retries += 1
120
122
  if retries < max_request_retries
121
123
  wait = retries * REQUEST_RETRY_TIMEBOX
122
- logger.warn("Wait #{wait}s and retry request to Knapsack Pro API.")
123
124
  print_every = 2 # seconds
124
125
  (wait / print_every).ceil.times do |i|
125
- logger.warn("Next request in #{wait - i * print_every}s...")
126
+ if i == 0
127
+ logger.warn("Wait for #{wait}s before retrying the request to Knapsack Pro API.")
128
+ else
129
+ logger.warn("#{wait - i * print_every}s left before retry...")
130
+ end
126
131
  Kernel.sleep(print_every)
127
132
  end
128
133
  retry
@@ -74,6 +74,10 @@ module KnapsackPro
74
74
  ENV['KNAPSACK_PRO_TEST_FILE_LIST']
75
75
  end
76
76
 
77
+ def test_file_list_source_file
78
+ ENV['KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE']
79
+ end
80
+
77
81
  def test_dir
78
82
  ENV['KNAPSACK_PRO_TEST_DIR']
79
83
  end
@@ -8,6 +8,7 @@ module KnapsackPro
8
8
  'development',
9
9
  'dev',
10
10
  'staging',
11
+ 'production',
11
12
  # GitHub Actions has branch names starting with refs/heads/
12
13
  'refs/heads/master',
13
14
  'refs/heads/main',
@@ -15,6 +16,7 @@ module KnapsackPro
15
16
  'refs/heads/development',
16
17
  'refs/heads/dev',
17
18
  'refs/heads/staging',
19
+ 'refs/heads/production',
18
20
  ]
19
21
 
20
22
  def self.call(branch)
@@ -33,7 +33,16 @@ module KnapsackPro
33
33
  options = ::RSpec::Core::ConfigurationOptions.new(cli_args)
34
34
  exit_code = ::RSpec::Core::Runner.new(options).run($stderr, $stdout)
35
35
  if exit_code != 0
36
- raise 'There was problem to generate test examples for test suite'
36
+ debug_cmd = ([
37
+ 'bundle exec rspec',
38
+ ] + cli_args).join(' ')
39
+
40
+ KnapsackPro.logger.error('-'*10 + ' START of actionable error message ' + '-'*50)
41
+ KnapsackPro.logger.error('There was a problem while generating test examples for the slow test files using the RSpec dry-run flag. To reproduce the error triggered by the RSpec, please try to run below command (this way, you can find out what is causing the error):')
42
+ KnapsackPro.logger.error(debug_cmd)
43
+ KnapsackPro.logger.error('-'*10 + ' END of actionable error message ' + '-'*50)
44
+
45
+ raise 'There was a problem while generating test examples for the slow test files. Please read actionable error message above.'
37
46
  end
38
47
  end
39
48
 
@@ -63,6 +63,10 @@ module KnapsackPro
63
63
  return KnapsackPro::Config::Env.test_file_list.split(',').map(&:strip)
64
64
  end
65
65
 
66
+ if test_file_list_enabled && KnapsackPro::Config::Env.test_file_list_source_file
67
+ return File.read(KnapsackPro::Config::Env.test_file_list_source_file).split(/\n/)
68
+ end
69
+
66
70
  test_file_paths = Dir.glob(test_file_pattern).uniq
67
71
 
68
72
  excluded_test_file_paths =
@@ -90,11 +90,7 @@ module KnapsackPro
90
90
  end
91
91
 
92
92
  def now_without_mock_time
93
- if defined?(Timecop)
94
- Time.now_without_mock_time
95
- else
96
- Time.raw_now
97
- end
93
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
98
94
  end
99
95
  end
100
96
  end
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '2.4.0'
2
+ VERSION = '2.9.0'
3
3
  end
@@ -0,0 +1,6 @@
1
+ ./spec/test1_spec.rb
2
+ spec/test2_spec.rb[1]
3
+ ./spec/test3_spec.rb[1:2:3:4]
4
+ ./spec/test4_spec.rb:4
5
+ ./spec/test4_spec.rb:5
6
+
@@ -84,22 +84,22 @@ shared_examples 'when retry request' do
84
84
  expect(logger).to receive(:error).exactly(3).with(parsed_response)
85
85
 
86
86
  server_error = described_class::ServerError.new(parsed_response)
87
+ expect(logger).to receive(:warn).exactly(3).with("#{expected_http_method} http://api.knapsackpro.test:3000/v1/fake_endpoint")
88
+ expect(logger).to receive(:warn).exactly(3).with('Request failed due to:')
87
89
  expect(logger).to receive(:warn).exactly(3).with(server_error.inspect)
88
90
 
89
- expect(logger).to receive(:warn).with("Wait 8s and retry request to Knapsack Pro API.")
90
- expect(logger).to receive(:warn).with("Next request in 8s...")
91
- expect(logger).to receive(:warn).with("Next request in 6s...")
92
- expect(logger).to receive(:warn).with("Next request in 4s...")
93
- expect(logger).to receive(:warn).with("Next request in 2s...")
94
- expect(logger).to receive(:warn).with("Wait 16s and retry request to Knapsack Pro API.")
95
- expect(logger).to receive(:warn).with("Next request in 16s...")
96
- expect(logger).to receive(:warn).with("Next request in 14s...")
97
- expect(logger).to receive(:warn).with("Next request in 12s...")
98
- expect(logger).to receive(:warn).with("Next request in 10s...")
99
- expect(logger).to receive(:warn).with("Next request in 8s...")
100
- expect(logger).to receive(:warn).with("Next request in 6s...")
101
- expect(logger).to receive(:warn).with("Next request in 4s...")
102
- expect(logger).to receive(:warn).with("Next request in 2s...")
91
+ expect(logger).to receive(:warn).with("Wait for 8s before retrying the request to Knapsack Pro API.")
92
+ expect(logger).to receive(:warn).with("6s left before retry...")
93
+ expect(logger).to receive(:warn).with("4s left before retry...")
94
+ expect(logger).to receive(:warn).with("2s left before retry...")
95
+ expect(logger).to receive(:warn).with("Wait for 16s before retrying the request to Knapsack Pro API.")
96
+ expect(logger).to receive(:warn).with("14s left before retry...")
97
+ expect(logger).to receive(:warn).with("12s left before retry...")
98
+ expect(logger).to receive(:warn).with("10s left before retry...")
99
+ expect(logger).to receive(:warn).with("8s left before retry...")
100
+ expect(logger).to receive(:warn).with("6s left before retry...")
101
+ expect(logger).to receive(:warn).with("4s left before retry...")
102
+ expect(logger).to receive(:warn).with("2s left before retry...")
103
103
  expect(Kernel).to receive(:sleep).exactly(12).with(2)
104
104
 
105
105
  expect(subject).to eq(parsed_response)
@@ -123,27 +123,27 @@ shared_examples 'when retry request' do
123
123
  expect(logger).to receive(:error).exactly(4).with(parsed_response)
124
124
 
125
125
  server_error = described_class::ServerError.new(parsed_response)
126
+ expect(logger).to receive(:warn).exactly(4).with("#{expected_http_method} http://api.knapsackpro.test:3000/v1/fake_endpoint")
127
+ expect(logger).to receive(:warn).exactly(4).with('Request failed due to:')
126
128
  expect(logger).to receive(:warn).exactly(4).with(server_error.inspect)
127
129
 
128
- expect(logger).to receive(:warn).with("Wait 8s and retry request to Knapsack Pro API.")
129
- expect(logger).to receive(:warn).with("Next request in 8s...")
130
- expect(logger).to receive(:warn).with("Next request in 6s...")
131
- expect(logger).to receive(:warn).with("Next request in 4s...")
132
- expect(logger).to receive(:warn).with("Next request in 2s...")
133
-
134
- expect(logger).to receive(:warn).with("Wait 16s and retry request to Knapsack Pro API.")
135
- expect(logger).to receive(:warn).with("Next request in 16s...")
136
- expect(logger).to receive(:warn).with("Next request in 14s...")
137
- expect(logger).to receive(:warn).with("Next request in 12s...")
138
- expect(logger).to receive(:warn).with("Next request in 10s...")
139
- expect(logger).to receive(:warn).with("Next request in 8s...")
140
- expect(logger).to receive(:warn).with("Next request in 6s...")
141
- expect(logger).to receive(:warn).with("Next request in 4s...")
142
- expect(logger).to receive(:warn).with("Next request in 2s...")
143
-
144
- expect(logger).to receive(:warn).with("Wait 24s and retry request to Knapsack Pro API.")
145
- 12.times do |i|
146
- expect(logger).to receive(:warn).with("Next request in #{(i+1)*2}s...")
130
+ expect(logger).to receive(:warn).with("Wait for 8s before retrying the request to Knapsack Pro API.")
131
+ expect(logger).to receive(:warn).with("6s left before retry...")
132
+ expect(logger).to receive(:warn).with("4s left before retry...")
133
+ expect(logger).to receive(:warn).with("2s left before retry...")
134
+
135
+ expect(logger).to receive(:warn).with("Wait for 16s before retrying the request to Knapsack Pro API.")
136
+ expect(logger).to receive(:warn).with("14s left before retry...")
137
+ expect(logger).to receive(:warn).with("12s left before retry...")
138
+ expect(logger).to receive(:warn).with("10s left before retry...")
139
+ expect(logger).to receive(:warn).with("8s left before retry...")
140
+ expect(logger).to receive(:warn).with("6s left before retry...")
141
+ expect(logger).to receive(:warn).with("4s left before retry...")
142
+ expect(logger).to receive(:warn).with("2s left before retry...")
143
+
144
+ expect(logger).to receive(:warn).with("Wait for 24s before retrying the request to Knapsack Pro API.")
145
+ 11.times do |i|
146
+ expect(logger).to receive(:warn).with("#{(i+1)*2}s left before retry...")
147
147
  end
148
148
 
149
149
  expect(Kernel).to receive(:sleep).exactly(4+8+12).with(2)
@@ -170,37 +170,37 @@ shared_examples 'when retry request' do
170
170
  expect(logger).to receive(:error).exactly(6).with(parsed_response)
171
171
 
172
172
  server_error = described_class::ServerError.new(parsed_response)
173
+ expect(logger).to receive(:warn).exactly(6).with("#{expected_http_method} http://api.knapsackpro.test:3000/v1/fake_endpoint")
174
+ expect(logger).to receive(:warn).exactly(6).with('Request failed due to:')
173
175
  expect(logger).to receive(:warn).exactly(6).with(server_error.inspect)
174
176
 
175
- expect(logger).to receive(:warn).with("Wait 8s and retry request to Knapsack Pro API.")
176
- expect(logger).to receive(:warn).with("Next request in 8s...")
177
- expect(logger).to receive(:warn).with("Next request in 6s...")
178
- expect(logger).to receive(:warn).with("Next request in 4s...")
179
- expect(logger).to receive(:warn).with("Next request in 2s...")
180
-
181
- expect(logger).to receive(:warn).with("Wait 16s and retry request to Knapsack Pro API.")
182
- expect(logger).to receive(:warn).with("Next request in 16s...")
183
- expect(logger).to receive(:warn).with("Next request in 14s...")
184
- expect(logger).to receive(:warn).with("Next request in 12s...")
185
- expect(logger).to receive(:warn).with("Next request in 10s...")
186
- expect(logger).to receive(:warn).with("Next request in 8s...")
187
- expect(logger).to receive(:warn).with("Next request in 6s...")
188
- expect(logger).to receive(:warn).with("Next request in 4s...")
189
- expect(logger).to receive(:warn).with("Next request in 2s...")
190
-
191
- expect(logger).to receive(:warn).with("Wait 24s and retry request to Knapsack Pro API.")
192
- 12.times do |i|
193
- expect(logger).to receive(:warn).with("Next request in #{(i+1)*2}s...")
177
+ expect(logger).to receive(:warn).with("Wait for 8s before retrying the request to Knapsack Pro API.")
178
+ expect(logger).to receive(:warn).with("6s left before retry...")
179
+ expect(logger).to receive(:warn).with("4s left before retry...")
180
+ expect(logger).to receive(:warn).with("2s left before retry...")
181
+
182
+ expect(logger).to receive(:warn).with("Wait for 16s before retrying the request to Knapsack Pro API.")
183
+ expect(logger).to receive(:warn).with("14s left before retry...")
184
+ expect(logger).to receive(:warn).with("12s left before retry...")
185
+ expect(logger).to receive(:warn).with("10s left before retry...")
186
+ expect(logger).to receive(:warn).with("8s left before retry...")
187
+ expect(logger).to receive(:warn).with("6s left before retry...")
188
+ expect(logger).to receive(:warn).with("4s left before retry...")
189
+ expect(logger).to receive(:warn).with("2s left before retry...")
190
+
191
+ expect(logger).to receive(:warn).with("Wait for 24s before retrying the request to Knapsack Pro API.")
192
+ 11.times do |i|
193
+ expect(logger).to receive(:warn).with("#{(i+1)*2}s left before retry...")
194
194
  end
195
195
 
196
- expect(logger).to receive(:warn).with("Wait 32s and retry request to Knapsack Pro API.")
197
- 16.times do |i|
198
- expect(logger).to receive(:warn).with("Next request in #{(i+1)*2}s...")
196
+ expect(logger).to receive(:warn).with("Wait for 32s before retrying the request to Knapsack Pro API.")
197
+ 15.times do |i|
198
+ expect(logger).to receive(:warn).with("#{(i+1)*2}s left before retry...")
199
199
  end
200
200
 
201
- expect(logger).to receive(:warn).with("Wait 40s and retry request to Knapsack Pro API.")
202
- 20.times do |i|
203
- expect(logger).to receive(:warn).with("Next request in #{(i+1)*2}s...")
201
+ expect(logger).to receive(:warn).with("Wait for 40s before retrying the request to Knapsack Pro API.")
202
+ 19.times do |i|
203
+ expect(logger).to receive(:warn).with("#{(i+1)*2}s left before retry...")
204
204
  end
205
205
 
206
206
  expect(Kernel).to receive(:sleep).exactly(60).with(2)
@@ -227,37 +227,37 @@ shared_examples 'when retry request' do
227
227
  expect(logger).to receive(:error).exactly(6).with(parsed_response)
228
228
 
229
229
  server_error = described_class::ServerError.new(parsed_response)
230
+ expect(logger).to receive(:warn).exactly(6).with("#{expected_http_method} http://api.knapsackpro.test:3000/v1/fake_endpoint")
231
+ expect(logger).to receive(:warn).exactly(6).with('Request failed due to:')
230
232
  expect(logger).to receive(:warn).exactly(6).with(server_error.inspect)
231
233
 
232
- expect(logger).to receive(:warn).with("Wait 8s and retry request to Knapsack Pro API.")
233
- expect(logger).to receive(:warn).with("Next request in 8s...")
234
- expect(logger).to receive(:warn).with("Next request in 6s...")
235
- expect(logger).to receive(:warn).with("Next request in 4s...")
236
- expect(logger).to receive(:warn).with("Next request in 2s...")
237
-
238
- expect(logger).to receive(:warn).with("Wait 16s and retry request to Knapsack Pro API.")
239
- expect(logger).to receive(:warn).with("Next request in 16s...")
240
- expect(logger).to receive(:warn).with("Next request in 14s...")
241
- expect(logger).to receive(:warn).with("Next request in 12s...")
242
- expect(logger).to receive(:warn).with("Next request in 10s...")
243
- expect(logger).to receive(:warn).with("Next request in 8s...")
244
- expect(logger).to receive(:warn).with("Next request in 6s...")
245
- expect(logger).to receive(:warn).with("Next request in 4s...")
246
- expect(logger).to receive(:warn).with("Next request in 2s...")
247
-
248
- expect(logger).to receive(:warn).with("Wait 24s and retry request to Knapsack Pro API.")
249
- 12.times do |i|
250
- expect(logger).to receive(:warn).with("Next request in #{(i+1)*2}s...")
234
+ expect(logger).to receive(:warn).with("Wait for 8s before retrying the request to Knapsack Pro API.")
235
+ expect(logger).to receive(:warn).with("6s left before retry...")
236
+ expect(logger).to receive(:warn).with("4s left before retry...")
237
+ expect(logger).to receive(:warn).with("2s left before retry...")
238
+
239
+ expect(logger).to receive(:warn).with("Wait for 16s before retrying the request to Knapsack Pro API.")
240
+ expect(logger).to receive(:warn).with("14s left before retry...")
241
+ expect(logger).to receive(:warn).with("12s left before retry...")
242
+ expect(logger).to receive(:warn).with("10s left before retry...")
243
+ expect(logger).to receive(:warn).with("8s left before retry...")
244
+ expect(logger).to receive(:warn).with("6s left before retry...")
245
+ expect(logger).to receive(:warn).with("4s left before retry...")
246
+ expect(logger).to receive(:warn).with("2s left before retry...")
247
+
248
+ expect(logger).to receive(:warn).with("Wait for 24s before retrying the request to Knapsack Pro API.")
249
+ 11.times do |i|
250
+ expect(logger).to receive(:warn).with("#{(i+1)*2}s left before retry...")
251
251
  end
252
252
 
253
- expect(logger).to receive(:warn).with("Wait 32s and retry request to Knapsack Pro API.")
254
- 16.times do |i|
255
- expect(logger).to receive(:warn).with("Next request in #{(i+1)*2}s...")
253
+ expect(logger).to receive(:warn).with("Wait for 32s before retrying the request to Knapsack Pro API.")
254
+ 15.times do |i|
255
+ expect(logger).to receive(:warn).with("#{(i+1)*2}s left before retry...")
256
256
  end
257
257
 
258
- expect(logger).to receive(:warn).with("Wait 40s and retry request to Knapsack Pro API.")
259
- 20.times do |i|
260
- expect(logger).to receive(:warn).with("Next request in #{(i+1)*2}s...")
258
+ expect(logger).to receive(:warn).with("Wait for 40s before retrying the request to Knapsack Pro API.")
259
+ 19.times do |i|
260
+ expect(logger).to receive(:warn).with("#{(i+1)*2}s left before retry...")
261
261
  end
262
262
 
263
263
  expect(Kernel).to receive(:sleep).exactly(60).with(2)
@@ -238,6 +238,20 @@ describe KnapsackPro::Config::Env do
238
238
  end
239
239
  end
240
240
 
241
+ describe '.test_file_list_source_file' do
242
+ subject { described_class.test_file_list_source_file }
243
+
244
+ context 'when ENV exists' do
245
+ let(:test_file_list_source_file) { 'spec/fixtures/test_file_list_source_file.txt' }
246
+ before { stub_const("ENV", { 'KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE' => test_file_list_source_file }) }
247
+ it { should eq test_file_list_source_file }
248
+ end
249
+
250
+ context "when ENV doesn't exist" do
251
+ it { should be_nil }
252
+ end
253
+ end
254
+
241
255
  describe '.test_dir' do
242
256
  subject { described_class.test_dir }
243
257
 
@@ -67,7 +67,7 @@ describe KnapsackPro::TestCaseDetectors::RSpecTestExampleDetector do
67
67
  let(:exit_code) { 1 }
68
68
 
69
69
  it do
70
- expect { subject }.to raise_error(RuntimeError, 'There was problem to generate test examples for test suite')
70
+ expect { subject }.to raise_error(RuntimeError, 'There was a problem while generating test examples for the slow test files. Please read actionable error message above.')
71
71
  end
72
72
  end
73
73
  end
@@ -154,5 +154,23 @@ describe KnapsackPro::TestFileFinder do
154
154
  end
155
155
  end
156
156
  end
157
+
158
+ context 'when KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE is defined' do
159
+ let(:test_file_list_source_file) { 'spec/fixtures/test_file_list_source_file.txt' }
160
+
161
+ before do
162
+ stub_const("ENV", { 'KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE' => test_file_list_source_file })
163
+ end
164
+
165
+ it do
166
+ expect(subject).to eq([
167
+ { 'path' => 'spec/test1_spec.rb' },
168
+ { 'path' => 'spec/test2_spec.rb[1]' },
169
+ { 'path' => 'spec/test3_spec.rb[1:2:3:4]' },
170
+ { 'path' => 'spec/test4_spec.rb:4' },
171
+ { 'path' => 'spec/test4_spec.rb:5' },
172
+ ])
173
+ end
174
+ end
157
175
  end
158
176
  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: 2.4.0
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-17 00:00:00.000000000 Z
11
+ date: 2020-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -308,6 +308,7 @@ files:
308
308
  - lib/tasks/salt.rake
309
309
  - lib/tasks/spinach.rake
310
310
  - lib/tasks/test_unit.rake
311
+ - spec/fixtures/test_file_list_source_file.txt
311
312
  - spec/fixtures/vcr_cassettes/api/v1/build_distributions/subset/invalid_test_suite_token.yml
312
313
  - spec/fixtures/vcr_cassettes/api/v1/build_distributions/subset/success.yml
313
314
  - spec/fixtures/vcr_cassettes/api/v1/build_subsets/create/invalid_test_suite_token.yml
@@ -428,6 +429,7 @@ specification_version: 4
428
429
  summary: Knapsack Pro splits tests across parallel CI nodes and ensures each parallel
429
430
  job finish work at a similar time.
430
431
  test_files:
432
+ - spec/fixtures/test_file_list_source_file.txt
431
433
  - spec/fixtures/vcr_cassettes/api/v1/build_distributions/subset/invalid_test_suite_token.yml
432
434
  - spec/fixtures/vcr_cassettes/api/v1/build_distributions/subset/success.yml
433
435
  - spec/fixtures/vcr_cassettes/api/v1/build_subsets/create/invalid_test_suite_token.yml