knapsack_pro 7.3.0 → 7.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36aaf057fe65e4608728092873edfc63eaa1a667347b9a2b1a2d0d6b816be04b
4
- data.tar.gz: 02cf4fd1181eece28c72266525498af71a474b954ab919056121b56a135429df
3
+ metadata.gz: 965d1d9b1d138cf0db8abe0fb44fc1672d5992d9f40f014c0f1f72c370d82585
4
+ data.tar.gz: 9570a9c2ffd20d1324451106f7a6144a298b6efb02981eabdc1f354d5c289940
5
5
  SHA512:
6
- metadata.gz: a6c8bf772b04582dcefb03d31e589930da021e60e43b6bb660b83215920030da0f553f24bb255435ce172a78c37fb80d18cf411f150d5b9cd4c5620ba9be91b1
7
- data.tar.gz: b543dc597458ad3e3fcfdf9de61117221832d8d472c96300adc8615ab7b36ab7d98951b5f849cff590a8f3db3e708f41051969f753fcaf9c5de0362ab4a6e85b
6
+ metadata.gz: e7b335edb2e4107b44b0bf69b7cffdf0af110e316ad3d1f07190d919e23fe7172cae3081c5f97450174f1e0597f9d71387dafd8a0861aca604531a9cb1b1c26c
7
+ data.tar.gz: 269bc36e25e5a2048f2105f973523bc00dfba73b38ebf7eac482b121a8cd22a129f72c671579bd230830bcb3aa600428d2f7a5a3410ce1515c7ee4353fc36dde
data/.circleci/config.yml CHANGED
@@ -152,6 +152,12 @@ jobs:
152
152
  command: |
153
153
  export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--regular"
154
154
  bundle exec rake knapsack_pro:rspec
155
+ - run:
156
+ working_directory: ~/rails-app-with-knapsack_pro
157
+ command: |
158
+ # retry the same split ||
159
+ export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--regular"
160
+ bundle exec rake knapsack_pro:rspec
155
161
  - run:
156
162
  working_directory: ~/rails-app-with-knapsack_pro
157
163
  command: |
@@ -285,6 +291,7 @@ jobs:
285
291
  RACK_ENV: test
286
292
  KNAPSACK_PRO_ENDPOINT: https://api-staging.knapsackpro.com
287
293
  KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST: $KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST
294
+ KNAPSACK_PRO_RSPEC_DISABLED: true
288
295
  EXTRA_TEST_FILES_DELAY: 10
289
296
  - image: cimg/postgres:14.7
290
297
  environment:
@@ -308,6 +315,12 @@ jobs:
308
315
  command: |
309
316
  export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--regular"
310
317
  bundle exec rake knapsack_pro:minitest[--verbose]
318
+ - run:
319
+ working_directory: ~/rails-app-with-knapsack_pro
320
+ command: |
321
+ # retry the same split ||
322
+ export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--regular"
323
+ bundle exec rake knapsack_pro:minitest[--verbose]
311
324
 
312
325
  e2e-queue-minitest:
313
326
  parameters:
@@ -325,6 +338,7 @@ jobs:
325
338
  RACK_ENV: test
326
339
  KNAPSACK_PRO_ENDPOINT: https://api-staging.knapsackpro.com
327
340
  KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST: $KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST
341
+ KNAPSACK_PRO_RSPEC_DISABLED: true
328
342
  EXTRA_TEST_FILES_DELAY: 10
329
343
  - image: cimg/postgres:14.7
330
344
  environment:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ### 7.4.0
4
+ * Warn when `KNAPSACK_PRO_*` environment variables are set manually if their values could be automatically determined from supported CI environments.
5
+
6
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/254
7
+
8
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v7.3.0...v7.4.0
9
+
3
10
  ### 7.3.0
4
11
 
5
12
  * [Queue Mode][RSpec] Pass each batch of tests to the queue hooks: `KnapsackPro::Hooks::Queue.before_subset_queue` and `KnapsackPro::Hooks::Queue.after_subset_queue`
@@ -13,30 +13,21 @@ module KnapsackPro
13
13
 
14
14
  class << self
15
15
  def ci_node_total
16
- (ENV['KNAPSACK_PRO_CI_NODE_TOTAL'] ||
17
- ci_env_for(:node_total) ||
18
- 1).to_i
16
+ (env_for('KNAPSACK_PRO_CI_NODE_TOTAL', :node_total) || 1).to_i
19
17
  end
20
18
 
21
19
  def ci_node_index
22
- (ENV['KNAPSACK_PRO_CI_NODE_INDEX'] ||
23
- ci_env_for(:node_index) ||
24
- 0).to_i
20
+ (env_for('KNAPSACK_PRO_CI_NODE_INDEX', :node_index) || 0).to_i
25
21
  end
26
22
 
27
23
  def ci_node_build_id
28
24
  env_name = 'KNAPSACK_PRO_CI_NODE_BUILD_ID'
29
- ENV[env_name] ||
30
- ci_env_for(:node_build_id) ||
25
+ env_for(env_name, :node_build_id) ||
31
26
  raise("Missing environment variable #{env_name}. Read more at #{KnapsackPro::Urls::KNAPSACK_PRO_CI_NODE_BUILD_ID}")
32
27
  end
33
28
 
34
29
  def ci_node_retry_count
35
- (
36
- ENV['KNAPSACK_PRO_CI_NODE_RETRY_COUNT'] ||
37
- ci_env_for(:node_retry_count) ||
38
- 0
39
- ).to_i
30
+ (env_for('KNAPSACK_PRO_CI_NODE_RETRY_COUNT', :node_retry_count) || 0).to_i
40
31
  end
41
32
 
42
33
  def max_request_retries
@@ -47,23 +38,19 @@ module KnapsackPro
47
38
  end
48
39
 
49
40
  def commit_hash
50
- ENV['KNAPSACK_PRO_COMMIT_HASH'] ||
51
- ci_env_for(:commit_hash)
41
+ env_for('KNAPSACK_PRO_COMMIT_HASH', :commit_hash)
52
42
  end
53
43
 
54
44
  def branch
55
- ENV['KNAPSACK_PRO_BRANCH'] ||
56
- ci_env_for(:branch)
45
+ env_for('KNAPSACK_PRO_BRANCH', :branch)
57
46
  end
58
47
 
59
48
  def project_dir
60
- ENV['KNAPSACK_PRO_PROJECT_DIR'] ||
61
- ci_env_for(:project_dir)
49
+ env_for('KNAPSACK_PRO_PROJECT_DIR', :project_dir)
62
50
  end
63
51
 
64
52
  def user_seat
65
- ENV['KNAPSACK_PRO_USER_SEAT'] ||
66
- ci_env_for(:user_seat)
53
+ env_for('KNAPSACK_PRO_USER_SEAT', :user_seat)
67
54
  end
68
55
 
69
56
  def masked_user_seat
@@ -183,7 +170,7 @@ module KnapsackPro
183
170
  def fixed_queue_split
184
171
  @fixed_queue_split ||= begin
185
172
  env_name = 'KNAPSACK_PRO_FIXED_QUEUE_SPLIT'
186
- computed = ENV.fetch(env_name, ci_env_for(:fixed_queue_split)).to_s
173
+ computed = env_for(env_name, :fixed_queue_split).to_s
187
174
 
188
175
  if !ENV.key?(env_name)
189
176
  KnapsackPro.logger.info("#{env_name} is not set. Using default value: #{computed}. Learn more at #{KnapsackPro::Urls::FIXED_QUEUE_SPLIT}")
@@ -249,10 +236,6 @@ module KnapsackPro
249
236
  end
250
237
  end
251
238
 
252
- def ci_env_for(env_name)
253
- detected_ci.new.send(env_name)
254
- end
255
-
256
239
  def detected_ci
257
240
  detected = KnapsackPro::Config::CI.constants.map do |constant|
258
241
  Object.const_get("KnapsackPro::Config::CI::#{constant}").new.detected
@@ -293,6 +276,21 @@ module KnapsackPro
293
276
  def required_env(env_name)
294
277
  ENV[env_name] || raise("Missing environment variable #{env_name}")
295
278
  end
279
+
280
+ def env_for(knapsack_env_name, ci_env_method)
281
+ knapsack_env_value = ENV[knapsack_env_name]
282
+ ci_env_value = ci_env_for(ci_env_method)
283
+
284
+ if !knapsack_env_value.nil? && !ci_env_value.nil? && knapsack_env_value != ci_env_value.to_s
285
+ KnapsackPro.logger.info("You have set the environment variable #{knapsack_env_name} to #{knapsack_env_value} which could be automatically determined from the CI environment as #{ci_env_value}.")
286
+ end
287
+
288
+ knapsack_env_value != nil ? knapsack_env_value : ci_env_value
289
+ end
290
+
291
+ def ci_env_for(env_name)
292
+ detected_ci.new.send(env_name)
293
+ end
296
294
  end
297
295
  end
298
296
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KnapsackPro
4
- VERSION = '7.3.0'
4
+ VERSION = '7.4.0'
5
5
  end
@@ -17,6 +17,40 @@ describe KnapsackPro::Config::Env do
17
17
 
18
18
  it { should eq 4 }
19
19
  end
20
+
21
+ context 'when both KNAPSACK_PRO_CI_NODE_TOTAL and CI environment have value' do
22
+ let(:logger) { instance_double(Logger, info: nil) }
23
+
24
+ before do
25
+ stub_const("ENV", { 'KNAPSACK_PRO_CI_NODE_TOTAL' => env_value })
26
+ expect(described_class).to receive(:ci_env_for).with(:node_total).and_return(ci_value)
27
+ allow(KnapsackPro).to receive(:logger).and_return(logger)
28
+ end
29
+
30
+ context 'when values are different' do
31
+ let(:env_value) { '5' }
32
+ let(:ci_value) { 4 }
33
+
34
+ it { should eq 5 }
35
+
36
+ it 'logs a warning' do
37
+ expect(logger).to receive(:info).with(
38
+ 'You have set the environment variable KNAPSACK_PRO_CI_NODE_TOTAL to 5 which could be automatically determined from the CI environment as 4.'
39
+ )
40
+ subject
41
+ end
42
+ end
43
+
44
+ context 'when values are the same' do
45
+ let(:env_value) { '5' }
46
+ let(:ci_value) { 5 }
47
+
48
+ it 'does not log a warning' do
49
+ expect(logger).not_to receive(:info)
50
+ subject
51
+ end
52
+ end
53
+ end
20
54
  end
21
55
 
22
56
  context "when ENV doesn't exist" do
@@ -41,6 +75,40 @@ describe KnapsackPro::Config::Env do
41
75
  it { should eq 2 }
42
76
  end
43
77
 
78
+ context 'when both KNAPSACK_PRO_CI_NODE_INDEX and CI environment have value' do
79
+ let(:logger) { instance_double(Logger, info: nil) }
80
+
81
+ before do
82
+ stub_const("ENV", { 'KNAPSACK_PRO_CI_NODE_INDEX' => env_value })
83
+ expect(described_class).to receive(:ci_env_for).with(:node_index).and_return(ci_value)
84
+ allow(KnapsackPro).to receive(:logger).and_return(logger)
85
+ end
86
+
87
+ context 'when values are different' do
88
+ let(:env_value) { '3' }
89
+ let(:ci_value) { 2 }
90
+
91
+ it { should eq 3 }
92
+
93
+ it 'logs a warning' do
94
+ expect(logger).to receive(:info).with(
95
+ 'You have set the environment variable KNAPSACK_PRO_CI_NODE_INDEX to 3 which could be automatically determined from the CI environment as 2.'
96
+ )
97
+ subject
98
+ end
99
+ end
100
+
101
+ context 'when values are the same' do
102
+ let(:env_value) { '3' }
103
+ let(:ci_value) { 3 }
104
+
105
+ it 'does not log a warning' do
106
+ expect(logger).not_to receive(:info)
107
+ subject
108
+ end
109
+ end
110
+ end
111
+
44
112
  context 'when order of loading envs does matter' do
45
113
  context 'when GitLab CI' do
46
114
  before { stub_const("ENV", { 'CI_NODE_INDEX' => '2', 'GITLAB_CI' => 'true' }) }
@@ -70,6 +138,40 @@ describe KnapsackPro::Config::Env do
70
138
 
71
139
  it { should eq '8' }
72
140
  end
141
+
142
+ context 'when both KNAPSACK_PRO_CI_NODE_BUILD_ID and CI environment have value' do
143
+ let(:logger) { instance_double(Logger, info: nil) }
144
+
145
+ before do
146
+ stub_const("ENV", { 'KNAPSACK_PRO_CI_NODE_BUILD_ID' => env_value })
147
+ expect(described_class).to receive(:ci_env_for).with(:node_build_id).and_return(ci_value)
148
+ allow(KnapsackPro).to receive(:logger).and_return(logger)
149
+ end
150
+
151
+ context 'when values are different' do
152
+ let(:env_value) { '7' }
153
+ let(:ci_value) { '8' }
154
+
155
+ it { should eq '7' }
156
+
157
+ it 'logs a warning' do
158
+ expect(logger).to receive(:info).with(
159
+ 'You have set the environment variable KNAPSACK_PRO_CI_NODE_BUILD_ID to 7 which could be automatically determined from the CI environment as 8.'
160
+ )
161
+ subject
162
+ end
163
+ end
164
+
165
+ context 'when values are the same' do
166
+ let(:env_value) { '7' }
167
+ let(:ci_value) { '7' }
168
+
169
+ it 'does not log a warning' do
170
+ expect(logger).not_to receive(:info)
171
+ subject
172
+ end
173
+ end
174
+ end
73
175
  end
74
176
 
75
177
  context "when ENV does not exist" do
@@ -95,6 +197,40 @@ describe KnapsackPro::Config::Env do
95
197
 
96
198
  it { should eq 2 }
97
199
  end
200
+
201
+ context 'when both KNAPSACK_PRO_CI_NODE_RETRY_COUNT and CI environment have value' do
202
+ let(:logger) { instance_double(Logger, info: nil) }
203
+
204
+ before do
205
+ stub_const("ENV", { 'KNAPSACK_PRO_CI_NODE_RETRY_COUNT' => env_value })
206
+ expect(described_class).to receive(:ci_env_for).with(:node_retry_count).and_return(ci_value)
207
+ allow(KnapsackPro).to receive(:logger).and_return(logger)
208
+ end
209
+
210
+ context 'when values are different' do
211
+ let(:env_value) { '1' }
212
+ let(:ci_value) { 2 }
213
+
214
+ it { should eq 1 }
215
+
216
+ it 'logs a warning' do
217
+ expect(logger).to receive(:info).with(
218
+ 'You have set the environment variable KNAPSACK_PRO_CI_NODE_RETRY_COUNT to 1 which could be automatically determined from the CI environment as 2.'
219
+ )
220
+ subject
221
+ end
222
+ end
223
+
224
+ context 'when values are the same' do
225
+ let(:env_value) { '7' }
226
+ let(:ci_value) { '7' }
227
+
228
+ it 'does not log a warning' do
229
+ expect(logger).not_to receive(:info)
230
+ subject
231
+ end
232
+ end
233
+ end
98
234
  end
99
235
 
100
236
  context "when ENV doesn't exist" do
@@ -131,6 +267,40 @@ describe KnapsackPro::Config::Env do
131
267
 
132
268
  it { should eq 'fe61a08118d0d52e97c38666eba1eaf3' }
133
269
  end
270
+
271
+ context 'when both KNAPSACK_PRO_COMMIT_HASH and CI environment have value' do
272
+ let(:logger) { instance_double(Logger, info: nil) }
273
+
274
+ before do
275
+ stub_const("ENV", { 'KNAPSACK_PRO_COMMIT_HASH' => env_value })
276
+ expect(described_class).to receive(:ci_env_for).with(:commit_hash).and_return(ci_value)
277
+ allow(KnapsackPro).to receive(:logger).and_return(logger)
278
+ end
279
+
280
+ context 'when values are different' do
281
+ let(:env_value) { '3fa64859337f6e56409d49f865d13fd7' }
282
+ let(:ci_value) { 'fe61a08118d0d52e97c38666eba1eaf3' }
283
+
284
+ it { should eq '3fa64859337f6e56409d49f865d13fd7' }
285
+
286
+ it 'logs a warning' do
287
+ expect(logger).to receive(:info).with(
288
+ 'You have set the environment variable KNAPSACK_PRO_COMMIT_HASH to 3fa64859337f6e56409d49f865d13fd7 which could be automatically determined from the CI environment as fe61a08118d0d52e97c38666eba1eaf3.'
289
+ )
290
+ subject
291
+ end
292
+ end
293
+
294
+ context 'when values are the same' do
295
+ let(:env_value) { '3fa64859337f6e56409d49f865d13fd7' }
296
+ let(:ci_value) { '3fa64859337f6e56409d49f865d13fd7' }
297
+
298
+ it 'does not log a warning' do
299
+ expect(logger).not_to receive(:info)
300
+ subject
301
+ end
302
+ end
303
+ end
134
304
  end
135
305
 
136
306
  context "when ENV doesn't exist" do
@@ -154,6 +324,40 @@ describe KnapsackPro::Config::Env do
154
324
 
155
325
  it { should eq 'feature-branch' }
156
326
  end
327
+
328
+ context 'when both KNAPSACK_PRO_BRANCH and CI environment have value' do
329
+ let(:logger) { instance_double(Logger, info: nil) }
330
+
331
+ before do
332
+ stub_const("ENV", { 'KNAPSACK_PRO_BRANCH' => env_value })
333
+ expect(described_class).to receive(:ci_env_for).with(:branch).and_return(ci_value)
334
+ allow(KnapsackPro).to receive(:logger).and_return(logger)
335
+ end
336
+
337
+ context 'when values are different' do
338
+ let(:env_value) { 'master' }
339
+ let(:ci_value) { 'feature-branch' }
340
+
341
+ it { should eq 'master' }
342
+
343
+ it 'logs a warning' do
344
+ expect(logger).to receive(:info).with(
345
+ 'You have set the environment variable KNAPSACK_PRO_BRANCH to master which could be automatically determined from the CI environment as feature-branch.'
346
+ )
347
+ subject
348
+ end
349
+ end
350
+
351
+ context 'when values are the same' do
352
+ let(:env_value) { 'master' }
353
+ let(:ci_value) { 'master' }
354
+
355
+ it 'does not log a warning' do
356
+ expect(logger).not_to receive(:info)
357
+ subject
358
+ end
359
+ end
360
+ end
157
361
  end
158
362
 
159
363
  context "when ENV doesn't exist" do
@@ -177,6 +381,40 @@ describe KnapsackPro::Config::Env do
177
381
 
178
382
  it { should eq '/home/runner/myapp' }
179
383
  end
384
+
385
+ context 'when both KNAPSACK_PRO_PROJECT_DIR and CI environment have value' do
386
+ let(:logger) { instance_double(Logger, info: nil) }
387
+
388
+ before do
389
+ stub_const("ENV", { 'KNAPSACK_PRO_PROJECT_DIR' => env_value })
390
+ expect(described_class).to receive(:ci_env_for).with(:project_dir).and_return(ci_value)
391
+ allow(KnapsackPro).to receive(:logger).and_return(logger)
392
+ end
393
+
394
+ context 'when values are different' do
395
+ let(:env_value) { '/home/user/myapp' }
396
+ let(:ci_value) { '/home/runner/myapp' }
397
+
398
+ it { should eq '/home/user/myapp' }
399
+
400
+ it 'logs a warning' do
401
+ expect(logger).to receive(:info).with(
402
+ 'You have set the environment variable KNAPSACK_PRO_PROJECT_DIR to /home/user/myapp which could be automatically determined from the CI environment as /home/runner/myapp.'
403
+ )
404
+ subject
405
+ end
406
+ end
407
+
408
+ context 'when values are the same' do
409
+ let(:env_value) { '/home/user/myapp' }
410
+ let(:ci_value) { '/home/user/myapp' }
411
+
412
+ it 'does not log a warning' do
413
+ expect(logger).not_to receive(:info)
414
+ subject
415
+ end
416
+ end
417
+ end
180
418
  end
181
419
 
182
420
  context "when ENV doesn't exist" do
@@ -200,6 +438,40 @@ describe KnapsackPro::Config::Env do
200
438
 
201
439
  it { should eq 'Jane Doe' }
202
440
  end
441
+
442
+ context 'when both KNAPSACK_PRO_USER_SEAT and CI environment have value' do
443
+ let(:logger) { instance_double(Logger, info: nil) }
444
+
445
+ before do
446
+ stub_const("ENV", { 'KNAPSACK_PRO_USER_SEAT' => env_value })
447
+ expect(described_class).to receive(:ci_env_for).with(:user_seat).and_return(ci_value)
448
+ allow(KnapsackPro).to receive(:logger).and_return(logger)
449
+ end
450
+
451
+ context 'when values are different' do
452
+ let(:env_value) { 'John Doe' }
453
+ let(:ci_value) { 'Jane Doe' }
454
+
455
+ it { should eq 'John Doe' }
456
+
457
+ it 'logs a warning' do
458
+ expect(logger).to receive(:info).with(
459
+ 'You have set the environment variable KNAPSACK_PRO_USER_SEAT to John Doe which could be automatically determined from the CI environment as Jane Doe.'
460
+ )
461
+ subject
462
+ end
463
+ end
464
+
465
+ context 'when values are the same' do
466
+ let(:env_value) { 'John Doe' }
467
+ let(:ci_value) { 'John Doe' }
468
+
469
+ it 'does not log a warning' do
470
+ expect(logger).not_to receive(:info)
471
+ subject
472
+ end
473
+ end
474
+ end
203
475
  end
204
476
 
205
477
  context "when ENV doesn't exist" do
@@ -345,7 +617,6 @@ describe KnapsackPro::Config::Env do
345
617
  end
346
618
  end
347
619
 
348
-
349
620
  describe '.regular_mode?' do
350
621
  subject { described_class.regular_mode? }
351
622
 
@@ -645,11 +916,18 @@ describe KnapsackPro::Config::Env do
645
916
  ['Unsupported CI', {}],
646
917
  ].each do |ci, env|
647
918
  it "on #{ci} it is false" do
919
+ stub_const("ENV", env.merge({ 'KNAPSACK_PRO_FIXED_QUEUE_SPLIT' => 'false' }))
920
+
648
921
  logger = instance_double(Logger)
649
922
  allow(KnapsackPro).to receive(:logger).and_return(logger)
650
- expect(logger).not_to receive(:info)
651
-
652
- stub_const("ENV", env.merge({ 'KNAPSACK_PRO_FIXED_QUEUE_SPLIT' => 'false' }))
923
+ ci_env = described_class.detected_ci.new.fixed_queue_split
924
+ if ci_env == false
925
+ expect(logger).not_to receive(:info)
926
+ else
927
+ expect(logger).to receive(:info).with(
928
+ 'You have set the environment variable KNAPSACK_PRO_FIXED_QUEUE_SPLIT to false which could be automatically determined from the CI environment as true.'
929
+ )
930
+ end
653
931
 
654
932
  expect(subject).to eq(false)
655
933
  end
@@ -673,11 +951,18 @@ describe KnapsackPro::Config::Env do
673
951
  ['Unsupported CI', {}],
674
952
  ].each do |ci, env|
675
953
  it "on #{ci} it is true" do
954
+ stub_const("ENV", env.merge({ 'KNAPSACK_PRO_FIXED_QUEUE_SPLIT' => 'true' }))
955
+
676
956
  logger = instance_double(Logger)
677
957
  allow(KnapsackPro).to receive(:logger).and_return(logger)
678
- expect(logger).not_to receive(:info)
679
-
680
- stub_const("ENV", env.merge({ 'KNAPSACK_PRO_FIXED_QUEUE_SPLIT' => 'true' }))
958
+ ci_env = described_class.detected_ci.new.fixed_queue_split
959
+ if ci_env == true
960
+ expect(logger).not_to receive(:info)
961
+ else
962
+ expect(logger).to receive(:info).with(
963
+ 'You have set the environment variable KNAPSACK_PRO_FIXED_QUEUE_SPLIT to true which could be automatically determined from the CI environment as false.'
964
+ )
965
+ end
681
966
 
682
967
  expect(subject).to eq(true)
683
968
  end
@@ -702,12 +987,12 @@ describe KnapsackPro::Config::Env do
702
987
  ['Unsupported CI', {}, true],
703
988
  ].each do |ci, env, expected|
704
989
  it "on #{ci} it is #{expected}" do
990
+ stub_const("ENV", env)
991
+
705
992
  logger = instance_double(Logger)
706
993
  expect(KnapsackPro).to receive(:logger).and_return(logger)
707
994
  expect(logger).to receive(:info).with("KNAPSACK_PRO_FIXED_QUEUE_SPLIT is not set. Using default value: #{expected}. Learn more at #{KnapsackPro::Urls::FIXED_QUEUE_SPLIT}")
708
995
 
709
- stub_const("ENV", env)
710
-
711
996
  expect(subject).to eq(expected)
712
997
  end
713
998
  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.3.0
4
+ version: 7.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-17 00:00:00.000000000 Z
11
+ date: 2024-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -415,7 +415,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
415
415
  - !ruby/object:Gem::Version
416
416
  version: '0'
417
417
  requirements: []
418
- rubygems_version: 3.4.19
418
+ rubygems_version: 3.5.6
419
419
  signing_key:
420
420
  specification_version: 4
421
421
  summary: Knapsack Pro splits tests across parallel CI nodes and ensures each parallel