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 +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/knapsack_pro/config/env.rb +13 -3
- data/lib/knapsack_pro/version.rb +1 -1
- data/spec/knapsack_pro/config/env_spec.rb +6 -2
- data/spec/knapsack_pro_spec.rb +3 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cea03959b8de66cd8cbb686deb3ac76129f9cce7ee24b1da2a0ef9e57dd790df
|
4
|
+
data.tar.gz: ec12a1f99f57207e967846df739a5dfea4a1423e6823431ee9cf26f1d2f9a473
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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] ||
|
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
|
data/lib/knapsack_pro/version.rb
CHANGED
@@ -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
|
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
|
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
|
|
data/spec/knapsack_pro_spec.rb
CHANGED
@@ -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
|
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
|
+
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-
|
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.
|
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
|