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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e248debc4bc1dd04e46fe1be7ed75a54d245b782
4
- data.tar.gz: 084848b68ebf859224d460bc74684cbc4d3b5c98
3
+ metadata.gz: 62f5fe8ad6da21e7f421537bbd82d0b13fecc22e
4
+ data.tar.gz: 7c839467909dc416378dd6f5d528b167f88ec659
5
5
  SHA512:
6
- metadata.gz: 2acdbf01e8c49ac212a82013a8a6295b891d69b557960f40a0f5152bf0d5d7cfea06e748a7e318e54588f40c196b003c6f51208d3f79a032675075e2cc69cddb
7
- data.tar.gz: 0048c16e8d0bcf0ee4d1333f25e8f346b95f76ea7eab9b182d7599c20943172fdd2e25123b3912284212df3031f128d853785e845809779760cc928e0ea3438d
6
+ metadata.gz: 0268b4f0be0166698d588d309f7fbeb764aafdb93522f5caf68187cf5aed36ec58b3a8ef84f34283cd811043f4cb27c938f016691c31bbb01ec4c97cba43ad42
7
+ data.tar.gz: f0956451a4c3160d5c0282adb69ab8cfd6e6ffddaec237bfdbe825c3c5591debbec649b8f6ffd39320e83dbb2a342940bed02b464c0c287964572fc3ca1a6d67
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 1.1.0
6
+
7
+ * Add support for Buildkite.com ENV variables `BUILDKITE_PARALLEL_JOB_COUNT` and `BUILDKITE_PARALLEL_JOB`.
8
+
5
9
  ### 1.0.4
6
10
 
7
11
  * Pull request #12 - Raise error when CI_NODE_INDEX >= CI_NODE_TOTAL
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Knapsack
2
- VERSION = '1.0.4'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -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
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-02-15 00:00:00.000000000 Z
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.5
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