knapsack_pro 0.52.0 → 0.53.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: f9c864837089f720e5ce33c85dae230c4acf15ce
4
- data.tar.gz: 54856bf95129f6ec4f76c939b7661cb1638cb7b2
3
+ metadata.gz: 159f31c8d3ff4a4ca650cab78612e3b91eaa22ff
4
+ data.tar.gz: 70c7eab12ce5ebb4cca891e8354e1ac7552ab154
5
5
  SHA512:
6
- metadata.gz: 8d504081bf233b8c46559d2a1dda98ab9bf3c43c25024c1881cefb55c333bbd6183ac47fcb1eb6501bd2b2a4ba43faf0e5d93bb10417077c4ad68d57c07255cb
7
- data.tar.gz: 5ec84936d95a7ea1835bdbdfc18c8a1b918d2e4478e35d37c7c06d1092eb2ac371965257e72f420635102d330132f457312a7f6759b62b066fc0a0ee9b5677e1
6
+ metadata.gz: 7d9b0f159b2f853cde6fbbf0a8abb3282d63069864f4f86c3d0e18b303618d97cc0d38f451888d06059dc01d58e9b0c485cad115a95262e0ba2caf44882cadad
7
+ data.tar.gz: 88c0e5d94901e187d4881faaa89c87833fb358ab335504310aab079288480d9105493fd6f73f1fbd2ec974ddf9fc3e425185b2eadf6e20900f2e9d641ce21cfe
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 0.53.0
6
+
7
+ * Add support for Heroku CI environment variables.
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/55
10
+
11
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v0.52.0...v0.53.0
12
+
5
13
  ### 0.52.0
6
14
 
7
15
  * Add support for Cucumber 3.
data/README.md CHANGED
@@ -104,6 +104,7 @@ The knapsack_pro has also [queue mode](#queue-mode) to get an optimal test suite
104
104
  - [Info for buildkite.com users](#info-for-buildkitecom-users)
105
105
  - [Info for Gitlab CI users](#info-for-gitlab-ci-users)
106
106
  - [Info for codeship.com users](#info-for-codeshipcom-users)
107
+ - [Info for Heroku CI users](#info-for-heroku-ci-users)
107
108
  - [Info for snap-ci.com users](#info-for-snap-cicom-users)
108
109
  - [Info for Jenkins users](#info-for-jenkins-users)
109
110
  - [FAQ](#faq)
@@ -900,6 +901,44 @@ KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=1 bundle exec rake knaps
900
901
 
901
902
  Remember to add API tokens like `KNAPSACK_PRO_TEST_SUITE_TOKEN_CUCUMBER` and `KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC` to `Environment` page of your project settings in Codeship.
902
903
 
904
+ #### Info for Heroku CI users
905
+
906
+ You can parallelize your tests on Heroku CI by configuring `app.json`.
907
+
908
+ You can set how many parallel dynos with tests you want to run with `quantity` value.
909
+ Use `test` key to run knapsack_pro gem.
910
+
911
+ You need to specify also the environment variable with API token for Knapsack Pro.
912
+ For any sensitive environment variables (like Knapsack Pro API token) that you do not want in your `app.json` manifest, you can add them to your pipeline’s Heroku CI settings.
913
+
914
+ Note the [Heroku CI Parallel Test Runs](https://devcenter.heroku.com/articles/heroku-ci-parallel-test-runs) are in Beta and you may need to ask Heroku support to enabled it for your project.
915
+
916
+ ```
917
+ # app.json
918
+ {
919
+ "environments": {
920
+ "test": {
921
+ "formation": {
922
+ "test": {
923
+ "quantity": 2
924
+ }
925
+ },
926
+ "addons": [
927
+ "heroku-postgresql"
928
+ ],
929
+ "scripts": {
930
+ "test": "bundle exec rake knapsack_pro:rspec"
931
+ },
932
+ "env": {
933
+ "KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC": "rspec-token"
934
+ }
935
+ }
936
+ }
937
+ }
938
+ ```
939
+
940
+ You can learn more about [Heroku CI](https://devcenter.heroku.com/articles/heroku-ci).
941
+
903
942
  #### Info for snap-ci.com users
904
943
 
905
944
  Knapsack Pro supports snap-ci.com ENVs `SNAP_WORKER_TOTAL` and `SNAP_WORKER_INDEX`. The only thing you need to do is to configure number of workers for your project in configuration settings in order to enable parallelism. Next thing is to set below commands to be executed in your stage:
data/lib/knapsack_pro.rb CHANGED
@@ -19,6 +19,7 @@ require_relative 'knapsack_pro/config/ci/buildkite'
19
19
  require_relative 'knapsack_pro/config/ci/travis'
20
20
  require_relative 'knapsack_pro/config/ci/snap_ci'
21
21
  require_relative 'knapsack_pro/config/ci/codeship'
22
+ require_relative 'knapsack_pro/config/ci/heroku'
22
23
  require_relative 'knapsack_pro/config/env'
23
24
  require_relative 'knapsack_pro/config/env_generator'
24
25
  require_relative 'knapsack_pro/client/api/action'
@@ -0,0 +1,31 @@
1
+ module KnapsackPro
2
+ module Config
3
+ module CI
4
+ class Heroku < Base
5
+ def node_total
6
+ ENV['CI_NODE_TOTAL']
7
+ end
8
+
9
+ def node_index
10
+ ENV['CI_NODE_INDEX']
11
+ end
12
+
13
+ def node_build_id
14
+ ENV['HEROKU_TEST_RUN_ID']
15
+ end
16
+
17
+ def commit_hash
18
+ ENV['HEROKU_TEST_RUN_COMMIT_VERSION']
19
+ end
20
+
21
+ def branch
22
+ ENV['HEROKU_TEST_RUN_BRANCH']
23
+ end
24
+
25
+ def project_dir
26
+ '/app' if node_build_id
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '0.52.0'
2
+ VERSION = '0.53.0'
3
3
  end
@@ -0,0 +1,87 @@
1
+ describe KnapsackPro::Config::CI::Heroku do
2
+ let(:env) { {} }
3
+
4
+ before do
5
+ stub_const('ENV', env)
6
+ end
7
+
8
+ it { should be_kind_of KnapsackPro::Config::CI::Base }
9
+
10
+ describe '#node_total' do
11
+ subject { described_class.new.node_total }
12
+
13
+ context 'when environment exists' do
14
+ let(:env) { { 'CI_NODE_TOTAL' => 4 } }
15
+ it { should eql 4 }
16
+ end
17
+
18
+ context "when environment doesn't exist" do
19
+ it { should be nil }
20
+ end
21
+ end
22
+
23
+ describe '#node_index' do
24
+ subject { described_class.new.node_index }
25
+
26
+ context 'when environment exists' do
27
+ let(:env) { { 'CI_NODE_INDEX' => 3 } }
28
+ it { should eql 3 }
29
+ end
30
+
31
+ context "when environment doesn't exist" do
32
+ it { should be nil }
33
+ end
34
+ end
35
+
36
+ describe '#node_build_id' do
37
+ subject { described_class.new.node_build_id }
38
+
39
+ context 'when environment exists' do
40
+ let(:env) { { 'HEROKU_TEST_RUN_ID' => 1234 } }
41
+ it { should eql 1234 }
42
+ end
43
+
44
+ context "when environment doesn't exist" do
45
+ it { should be nil }
46
+ end
47
+ end
48
+
49
+ describe '#commit_hash' do
50
+ subject { described_class.new.commit_hash }
51
+
52
+ context 'when environment exists' do
53
+ let(:env) { { 'HEROKU_TEST_RUN_COMMIT_VERSION' => 'abbaec3ee5d334fd658da35646b42bc5' } }
54
+ it { should eql 'abbaec3ee5d334fd658da35646b42bc5' }
55
+ end
56
+
57
+ context "when environment doesn't exist" do
58
+ it { should be nil }
59
+ end
60
+ end
61
+
62
+ describe '#branch' do
63
+ subject { described_class.new.branch }
64
+
65
+ context 'when environment exists' do
66
+ let(:env) { { 'HEROKU_TEST_RUN_BRANCH' => 'master' } }
67
+ it { should eql 'master' }
68
+ end
69
+
70
+ context "when environment doesn't exist" do
71
+ it { should be nil }
72
+ end
73
+ end
74
+
75
+ describe '#project_dir' do
76
+ subject { described_class.new.project_dir }
77
+
78
+ context 'when environment exists' do
79
+ let(:env) { { 'HEROKU_TEST_RUN_ID' => 1234 } }
80
+ it { should eq '/app' }
81
+ end
82
+
83
+ context "when environment doesn't exist" do
84
+ it { should be nil }
85
+ end
86
+ end
87
+ 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: 0.52.0
4
+ version: 0.53.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-22 00:00:00.000000000 Z
11
+ date: 2017-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -238,6 +238,7 @@ files:
238
238
  - lib/knapsack_pro/config/ci/circle.rb
239
239
  - lib/knapsack_pro/config/ci/codeship.rb
240
240
  - lib/knapsack_pro/config/ci/gitlab_ci.rb
241
+ - lib/knapsack_pro/config/ci/heroku.rb
241
242
  - lib/knapsack_pro/config/ci/semaphore.rb
242
243
  - lib/knapsack_pro/config/ci/snap_ci.rb
243
244
  - lib/knapsack_pro/config/ci/travis.rb
@@ -313,6 +314,7 @@ files:
313
314
  - spec/knapsack_pro/config/ci/circle_spec.rb
314
315
  - spec/knapsack_pro/config/ci/codeship_spec.rb
315
316
  - spec/knapsack_pro/config/ci/gitlab_ci_spec.rb
317
+ - spec/knapsack_pro/config/ci/heroku_spec.rb
316
318
  - spec/knapsack_pro/config/ci/semaphore_spec.rb
317
319
  - spec/knapsack_pro/config/ci/snap_ci_spec.rb
318
320
  - spec/knapsack_pro/config/ci/travis_spec.rb
@@ -381,7 +383,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
381
383
  version: '0'
382
384
  requirements: []
383
385
  rubyforge_project:
384
- rubygems_version: 2.6.11
386
+ rubygems_version: 2.6.13
385
387
  signing_key:
386
388
  specification_version: 4
387
389
  summary: Knapsack Pro splits tests across CI nodes and makes sure that tests will
@@ -413,6 +415,7 @@ test_files:
413
415
  - spec/knapsack_pro/config/ci/circle_spec.rb
414
416
  - spec/knapsack_pro/config/ci/codeship_spec.rb
415
417
  - spec/knapsack_pro/config/ci/gitlab_ci_spec.rb
418
+ - spec/knapsack_pro/config/ci/heroku_spec.rb
416
419
  - spec/knapsack_pro/config/ci/semaphore_spec.rb
417
420
  - spec/knapsack_pro/config/ci/snap_ci_spec.rb
418
421
  - spec/knapsack_pro/config/ci/travis_spec.rb