knapsack 1.0.1 → 1.0.2

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: 5171bf868196514551699fe2604e1ee1844920e2
4
- data.tar.gz: 6c1fd98385306d4fdc80a806c325c54ffd470d0b
3
+ metadata.gz: e65fdc9823d7ad10bb38a4d96663526897528565
4
+ data.tar.gz: ac938b8d273c278c79b87b961a48edd716c0f8a5
5
5
  SHA512:
6
- metadata.gz: 6c62afcf1e03a56bdf8abe71b2682b969d30ca1895a4854a8533b3ed314ee188b5e37b9f066c5b9ad626f676fbb7e08a06be6697bb3b621d217f7cda4fb96dbe
7
- data.tar.gz: 3946fb08bceb702502ded292da873c4016677aa82ac85ed958186727186ea2476db01fe7b74e6230709f67cadd579ff1a6ff59384c043dfb12cefa95dbcd93e3
6
+ metadata.gz: 67cfb99f75768e27301dc1d0446c5950b8d97640eec3f98062832004d0c2be2931cc2f0421c641817ed50c713fb464a3ee059208fb4bb18d0e58065015f16a18
7
+ data.tar.gz: 70bf4d8fe18658b1dbeece948208c7b1d2d147384fe59564546976d2b8a1775638ae0cd113d3fc873143b5e3259f5d4e69355ae69d087ba13a6939a15f140c40
data/.travis.yml CHANGED
@@ -3,10 +3,8 @@ language: ruby
3
3
  rvm:
4
4
  - 1.9.3
5
5
  - 2.0.0
6
- - 2.1.0
7
- - 2.1.1
8
- - 2.1.2
9
- - 2.1.3
6
+ - 2.1.5
7
+ - 2.2.0
10
8
  addons:
11
9
  code_climate:
12
10
  repo_token: 38686058eed480dd0fcf8bce9015733e0bae88e44e30f4a1ac63df8aec2f86d8
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 1.0.2
6
+
7
+ * Fix bug #8 - Sort all tests just in case to avoid wrong order of files when running tests on machines where `Dir.glob` has different implementation.
8
+
5
9
  ### 1.0.1
6
10
 
7
11
  * Fix bug - Add support for Cucumber Scenario Outline.
data/README.md CHANGED
@@ -116,6 +116,12 @@ Commit generated report `knapsack_rspec_report.json` or `knapsack_cucumber_repor
116
116
 
117
117
  This report should be updated only after you add a lot of new slow tests or you change existing ones which causes a big time execution difference between CI nodes. Either way, you will get time offset warning at the end of the rspec/cucumber results which reminds you when it’s a good time to regenerate the knapsack report.
118
118
 
119
+ #### Adding or removing tests
120
+
121
+ There is no need to regenerate the report every time when you add/remove test file. If you remove a test file then Knapsack will ignore its entry in report. In case when you add a new file and it doesn't already exist in report, the test file will be assigned to one of the CI node.
122
+
123
+ You'll want to regenerate your execution report whenever you remove or add a test file with a long time execution time that would affect one of the CI nodes. You will get Knapsack notification whenever is good time to regenerate report.
124
+
119
125
  ## Setup your CI server
120
126
 
121
127
  On your CI server run this command for the first CI node. Update `CI_NODE_INDEX` for the next one.
@@ -213,11 +219,12 @@ Now everything should works. You will get warning at the end of rspec/cucumber r
213
219
  For the first time run all tests at once with enabled report generator. Edit `.travis.yml`
214
220
 
215
221
  ```yaml
216
- # Step for RSpec
217
- script: "KNAPSACK_GENERATE_REPORT=true bundle exec rspec spec"
222
+ script:
223
+ # Step for RSpec
224
+ - "KNAPSACK_GENERATE_REPORT=true bundle exec rspec spec"
218
225
 
219
- # Step for Cucumber
220
- script: "KNAPSACK_GENERATE_REPORT=true bundle exec cucumber features"
226
+ # Step for Cucumber
227
+ - "KNAPSACK_GENERATE_REPORT=true bundle exec cucumber features"
221
228
  ```
222
229
 
223
230
  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.
@@ -227,11 +234,12 @@ After tests pass your should copy knapsack json report which is rendered at the
227
234
  You can parallel your builds across virtual machines with [travis matrix feature](http://docs.travis-ci.com/user/speeding-up-the-build/#Parallelizing-your-builds-across-virtual-machines). Edit `.travis.yml`
228
235
 
229
236
  ```yaml
230
- # Step for RSpec
231
- script: "bundle exec rake knapsack:rspec"
237
+ script:
238
+ # Step for RSpec
239
+ - "bundle exec rake knapsack:rspec"
232
240
 
233
- # Step for Cucumber
234
- script: "bundle exec rake knapsack:cucumber"
241
+ # Step for Cucumber
242
+ - "bundle exec rake knapsack:cucumber"
235
243
 
236
244
  env:
237
245
  - CI_NODE_TOTAL=2 CI_NODE_INDEX=0
@@ -241,11 +249,12 @@ env:
241
249
  If you want to have some global ENVs and matrix of ENVs then do it like this:
242
250
 
243
251
  ```yaml
244
- # Step for RSpec
245
- script: "bundle exec rake knapsack:rspec"
252
+ script:
253
+ # Step for RSpec
254
+ - "bundle exec rake knapsack:rspec"
246
255
 
247
- # Step for Cucumber
248
- script: "bundle exec rake knapsack:cucumber"
256
+ # Step for Cucumber
257
+ - "bundle exec rake knapsack:cucumber"
249
258
 
250
259
  env:
251
260
  global:
@@ -341,5 +350,6 @@ Many thanks to [Małgorzata Nowak](https://github.com/informatykgosia) for beaut
341
350
  ## Mentions
342
351
 
343
352
  * Lunar Logic Blog | [Parallel your specs and don’t waste time](http://blog.lunarlogic.io/2014/parallel-your-specs-and-dont-waste-time/)
344
- * Travis CI | [Parallelizing RSpec tests on multiple VMs](http://docs.travis-ci.com/user/speeding-up-the-build/#Parallelizing-RSpec-tests-on-multiple-VMs)
353
+ * Travis CI | [Parallelizing RSpec and Cucumber on multiple VMs](http://docs.travis-ci.com/user/speeding-up-the-build/#Parallelizing-RSpec-and-Cucumber-on-multiple-VMs)
345
354
  * Semaphore | [Running RSpec specs in parallel](https://semaphoreapp.com/docs/running-rspec-specs-in-threads.html)
355
+ * Semaphore | [Running Cucumber scenarios in parallel](https://semaphoreapp.com/docs/running-cucumber-scenarios-in-threads.html)
@@ -33,7 +33,7 @@ module Knapsack
33
33
  end
34
34
 
35
35
  def all_tests
36
- @all_tests ||= Dir[test_file_pattern]
36
+ @all_tests ||= Dir[test_file_pattern].sort
37
37
  end
38
38
 
39
39
  protected
@@ -22,6 +22,17 @@ module Knapsack
22
22
  def post_assign_test_files_to_node
23
23
  assign_slow_test_files
24
24
  assign_remaining_test_files
25
+ sort_assigned_test_files
26
+ end
27
+
28
+ def sort_assigned_test_files
29
+ ci_node_total.times do |index|
30
+ # sort by first key (file name)
31
+ # reverse it and then sort by second key (time) in reverse order
32
+ node_tests[index][:test_files_with_time].sort!.reverse!.sort! do |x, y|
33
+ y[1] <=> x[1]
34
+ end
35
+ end
25
36
  end
26
37
 
27
38
  def post_tests_for_node(node_index)
@@ -52,6 +52,9 @@ or bump time_offset_in_seconds setting.}
52
52
  Global time execution for this CI node is fine.
53
53
  Happy testing!}
54
54
  end
55
+ str << "\n=================================================\n"
56
+ str << %{Sign up for beta Knapsack Pro here:
57
+ http://knapsack.launchrock.com}
55
58
  str << "\n=================================================\n"
56
59
  str
57
60
  end
@@ -1,3 +1,3 @@
1
1
  module Knapsack
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
@@ -147,8 +147,8 @@ describe Knapsack::Distributors::ReportDistributor do
147
147
  :test_files_with_time => [
148
148
  ["f_spec.rb", 3.5],
149
149
  ["d_spec.rb", 2.5],
150
- ["a_spec.rb", 1.0],
151
- ["b_spec.rb", 1.5]
150
+ ["b_spec.rb", 1.5],
151
+ ["a_spec.rb", 1.0]
152
152
  ]
153
153
  })
154
154
  end
@@ -158,9 +158,9 @@ describe Knapsack::Distributors::ReportDistributor do
158
158
  :node_index => 2,
159
159
  :time_left => 0.5,
160
160
  :test_files_with_time => [
161
+ ["i_spec.rb", 3.0],
161
162
  ["h_spec.rb", 3.0],
162
- ["c_spec.rb", 2.0],
163
- ["i_spec.rb", 3.0]
163
+ ["c_spec.rb", 2.0]
164
164
  ]
165
165
  })
166
166
  end
@@ -172,8 +172,8 @@ describe Knapsack::Distributors::ReportDistributor do
172
172
  expect(distributor.tests_for_node(1)).to eql([
173
173
  'f_spec.rb',
174
174
  'd_spec.rb',
175
- 'a_spec.rb',
176
- 'b_spec.rb'
175
+ 'b_spec.rb',
176
+ 'a_spec.rb'
177
177
  ])
178
178
  end
179
179
  end
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.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-23 00:00:00.000000000 Z
11
+ date: 2015-01-09 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.2.2
219
+ rubygems_version: 2.4.5
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