knapsack_pro 7.4.0 → 7.5.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: 965d1d9b1d138cf0db8abe0fb44fc1672d5992d9f40f014c0f1f72c370d82585
4
- data.tar.gz: 9570a9c2ffd20d1324451106f7a6144a298b6efb02981eabdc1f354d5c289940
3
+ metadata.gz: cea03959b8de66cd8cbb686deb3ac76129f9cce7ee24b1da2a0ef9e57dd790df
4
+ data.tar.gz: ec12a1f99f57207e967846df739a5dfea4a1423e6823431ee9cf26f1d2f9a473
5
5
  SHA512:
6
- metadata.gz: e7b335edb2e4107b44b0bf69b7cffdf0af110e316ad3d1f07190d919e23fe7172cae3081c5f97450174f1e0597f9d71387dafd8a0861aca604531a9cb1b1c26c
7
- data.tar.gz: 269bc36e25e5a2048f2105f973523bc00dfba73b38ebf7eac482b121a8cd22a129f72c671579bd230830bcb3aa600428d2f7a5a3410ce1515c7ee4353fc36dde
6
+ metadata.gz: cd53605f0d47ce2a3bc83410eb56d459a65aa1b75b169c420f5a11e3693b2aa7abee8e5b984eff35ab876de53809a2c113abb38b253e1e1b42726c817bccae6b
7
+ data.tar.gz: 93eaec09e20ba573cfb69b0f1ad2e8a04f5db2ab95637767a1abed0d8640cf131447b1adae67196998d73165232ea1a23e2c1fe547ab01b14436ace7d422edc5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ### 7.5.0
4
+ * Raise when `KNAPSACK_PRO_CI_NODE_TOTAL` or `KNAPSACK_PRO_CI_NODE_INDEX` is missing and can't be determined from supported CI environments, instead of defaulting to arbitrary numbers.
5
+
6
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/256
7
+
8
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v7.4.0...v7.5.0
9
+
3
10
  ### 7.4.0
4
11
  * Warn when `KNAPSACK_PRO_*` environment variables are set manually if their values could be automatically determined from supported CI environments.
5
12
 
@@ -13,11 +13,17 @@ module KnapsackPro
13
13
 
14
14
  class << self
15
15
  def ci_node_total
16
- (env_for('KNAPSACK_PRO_CI_NODE_TOTAL', :node_total) || 1).to_i
16
+ env_name = 'KNAPSACK_PRO_CI_NODE_TOTAL'
17
+ env_value = env_for(env_name, :node_total)
18
+
19
+ env_value ? env_value.to_i : raise_missing_env_for(env_name)
17
20
  end
18
21
 
19
22
  def ci_node_index
20
- (env_for('KNAPSACK_PRO_CI_NODE_INDEX', :node_index) || 0).to_i
23
+ env_name = 'KNAPSACK_PRO_CI_NODE_INDEX'
24
+ env_value = env_for(env_name, :node_index)
25
+
26
+ env_value ? env_value.to_i : raise_missing_env_for(env_name)
21
27
  end
22
28
 
23
29
  def ci_node_build_id
@@ -274,7 +280,7 @@ module KnapsackPro
274
280
  private
275
281
 
276
282
  def required_env(env_name)
277
- ENV[env_name] || raise("Missing environment variable #{env_name}")
283
+ ENV[env_name] || raise_missing_env_for(env_name)
278
284
  end
279
285
 
280
286
  def env_for(knapsack_env_name, ci_env_method)
@@ -291,6 +297,10 @@ module KnapsackPro
291
297
  def ci_env_for(env_name)
292
298
  detected_ci.new.send(env_name)
293
299
  end
300
+
301
+ def raise_missing_env_for(env_name)
302
+ raise("Missing environment variable #{env_name}")
303
+ end
294
304
  end
295
305
  end
296
306
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KnapsackPro
4
- VERSION = '7.4.0'
4
+ VERSION = '7.5.0'
5
5
  end
@@ -54,7 +54,9 @@ describe KnapsackPro::Config::Env do
54
54
  end
55
55
 
56
56
  context "when ENV doesn't exist" do
57
- it { should eq 1 }
57
+ it 'raises' do
58
+ expect { subject }.to raise_error(/Missing environment variable KNAPSACK_PRO_CI_NODE_TOTAL/)
59
+ end
58
60
  end
59
61
  end
60
62
 
@@ -118,7 +120,9 @@ describe KnapsackPro::Config::Env do
118
120
  end
119
121
 
120
122
  context "when ENV doesn't exist" do
121
- it { should eq 0 }
123
+ it 'raises' do
124
+ expect { subject }.to raise_error(/Missing environment variable KNAPSACK_PRO_CI_NODE_INDEX/)
125
+ end
122
126
  end
123
127
  end
124
128
 
@@ -36,13 +36,11 @@ describe KnapsackPro do
36
36
  stub_const('ENV', {
37
37
  'KNAPSACK_PRO_LOG_DIR' => 'log',
38
38
  })
39
-
40
- expect(Logger).to receive(:new).with('log/knapsack_pro_node_0.log').and_return(logger)
41
- expect(logger).to receive(:level=).with(Logger::INFO)
42
- expect(KnapsackPro::LoggerWrapper).to receive(:new).with(logger).and_return(logger_wrapper)
43
39
  end
44
40
 
45
- it { should eql logger_wrapper }
41
+ it 'raises' do
42
+ expect { subject }.to raise_error(/Missing environment variable KNAPSACK_PRO_CI_NODE_INDEX/)
43
+ end
46
44
  end
47
45
  end
48
46
 
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.4.0
4
+ version: 7.5.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-23 00:00:00.000000000 Z
11
+ date: 2024-05-27 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.5.6
418
+ rubygems_version: 3.4.10
419
419
  signing_key:
420
420
  specification_version: 4
421
421
  summary: Knapsack Pro splits tests across parallel CI nodes and ensures each parallel