knapsack 1.0.4 → 1.1.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 +4 -0
- data/README.md +24 -0
- data/lib/knapsack/config/env.rb +2 -2
- data/lib/knapsack/version.rb +1 -1
- data/spec/knapsack/config/env_spec.rb +10 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62f5fe8ad6da21e7f421537bbd82d0b13fecc22e
|
4
|
+
data.tar.gz: 7c839467909dc416378dd6f5d528b167f88ec659
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0268b4f0be0166698d588d309f7fbeb764aafdb93522f5caf68187cf5aed36ec58b3a8ef84f34283cd811043f4cb27c938f016691c31bbb01ec4c97cba43ad42
|
7
|
+
data.tar.gz: f0956451a4c3160d5c0282adb69ab8cfd6e6ffddaec237bfdbe825c3c5591debbec649b8f6ffd39320e83dbb2a342940bed02b464c0c287964572fc3ca1a6d67
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -305,6 +305,30 @@ Knapsack supports semaphoreapp ENVs `SEMAPHORE_THREAD_COUNT` and `SEMAPHORE_CURR
|
|
305
305
|
|
306
306
|
Tests will be split across threads.
|
307
307
|
|
308
|
+
### Info for buildkite.com users
|
309
|
+
|
310
|
+
#### Step 1
|
311
|
+
|
312
|
+
For the first time run all tests at once with enabled report generator. Run the following commands locally:
|
313
|
+
|
314
|
+
# Step for RSpec
|
315
|
+
KNAPSACK_GENERATE_REPORT=true bundle exec rspec spec
|
316
|
+
|
317
|
+
# Step for Cucumber
|
318
|
+
KNAPSACK_GENERATE_REPORT=true bundle exec cucumber features
|
319
|
+
|
320
|
+
After tests pass your should copy knapsack json report which is rendered at the end of rspec/cucumber results. Save it into your repository as `knapsack_rspec_report.json` or `knapsack_cucumber_report.json` file and commit.
|
321
|
+
|
322
|
+
#### Step 2
|
323
|
+
|
324
|
+
Knapsack supports buildkite ENVs `BUILDKITE_PARALLEL_JOB_COUNT` and `BUILDKITE_PARALLEL_JOB`. The only thing you need to do is to configure the parallelism parameter in your build step and run the appropiate command in your build
|
325
|
+
|
326
|
+
# Step for RSpec
|
327
|
+
bundle exec rake knapsack:rspec
|
328
|
+
|
329
|
+
# Step for Cucumber
|
330
|
+
bundle exec rake knapsack:cucumber
|
331
|
+
|
308
332
|
## Gem tests
|
309
333
|
|
310
334
|
### Spec
|
data/lib/knapsack/config/env.rb
CHANGED
@@ -7,11 +7,11 @@ module Knapsack
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def ci_node_total
|
10
|
-
ENV['CI_NODE_TOTAL'] || ENV['CIRCLE_NODE_TOTAL'] || ENV['SEMAPHORE_THREAD_COUNT'] || 1
|
10
|
+
ENV['CI_NODE_TOTAL'] || ENV['CIRCLE_NODE_TOTAL'] || ENV['SEMAPHORE_THREAD_COUNT'] || ENV['BUILDKITE_PARALLEL_JOB_COUNT'] || 1
|
11
11
|
end
|
12
12
|
|
13
13
|
def ci_node_index
|
14
|
-
ENV['CI_NODE_INDEX'] || ENV['CIRCLE_NODE_INDEX'] || semaphore_current_thread || 0
|
14
|
+
ENV['CI_NODE_INDEX'] || ENV['CIRCLE_NODE_INDEX'] || semaphore_current_thread || ENV['BUILDKITE_PARALLEL_JOB'] || 0
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_file_pattern
|
data/lib/knapsack/version.rb
CHANGED
@@ -31,6 +31,11 @@ describe Knapsack::Config::Env do
|
|
31
31
|
before { stub_const("ENV", { 'SEMAPHORE_THREAD_COUNT' => 3 }) }
|
32
32
|
it { should eql 3 }
|
33
33
|
end
|
34
|
+
|
35
|
+
context 'when BUILDKITE_PARALLEL_JOB_COUNT has value' do
|
36
|
+
before { stub_const("ENV", { 'BUILDKITE_PARALLEL_JOB_COUNT' => 4 }) }
|
37
|
+
it { should eql 4 }
|
38
|
+
end
|
34
39
|
end
|
35
40
|
|
36
41
|
context "when ENV doesn't exist" do
|
@@ -56,6 +61,11 @@ describe Knapsack::Config::Env do
|
|
56
61
|
before { stub_const("ENV", { 'SEMAPHORE_CURRENT_THREAD' => 1 }) }
|
57
62
|
it { should eql 0 }
|
58
63
|
end
|
64
|
+
|
65
|
+
context 'when BUILDKITE_PARALLEL_JOB has value' do
|
66
|
+
before { stub_const("ENV", { 'BUILDKITE_PARALLEL_JOB' => 2 }) }
|
67
|
+
it { should eql 2 }
|
68
|
+
end
|
59
69
|
end
|
60
70
|
|
61
71
|
context "when ENV doesn't exist" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knapsack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ArturT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -216,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
216
216
|
version: '0'
|
217
217
|
requirements: []
|
218
218
|
rubyforge_project:
|
219
|
-
rubygems_version: 2.4.
|
219
|
+
rubygems_version: 2.4.6
|
220
220
|
signing_key:
|
221
221
|
specification_version: 4
|
222
222
|
summary: Knapsack splits tests across CI nodes and makes sure that tests will run
|