parallel_tests 2.2.2 → 2.3.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: 1845793bf53e304ba2fcd7b3597f383b31b8b8a8
4
- data.tar.gz: 23622090c253a5af401ef124c3e9d48c8a627ead
3
+ metadata.gz: bf3c37871a820f86c06a1f2a5a5a9dabadf6e7c5
4
+ data.tar.gz: aa7f9ae0f442390ddd4fb38ad5bfe5dc46448806
5
5
  SHA512:
6
- metadata.gz: 3fff6263cad7523b4c5846e633ae5690325c6b04dbad04f5e95b8539de1ccbbd99733fa9584a461f04bbc646d0c7b24f09036f373f7ed0ccc44e147238195910
7
- data.tar.gz: 99e3af37c79faff9aee6c81b2e573d5d309973cafdf54cb80f6090a8165018540990e5cb3376012d94ea433596a63425984811c241779c81e6b3580a40617c15
6
+ metadata.gz: 4d63c6145253a47d09b065b76acc923b6ee2acc37189523b8ffef02854e8a0127ba6b1f10d732820482a15f13ac518481b30cf81b2bcd3331b6f0988283ec557
7
+ data.tar.gz: f158a3f0c44ffa43411c43a86dbc8ef89a415bb7a0862489acc84895249e6d9697d12f5d5d840f578911beabeebef5639725e7e8402e28a9114f8eb891fa4287
data/Readme.md CHANGED
@@ -228,8 +228,9 @@ You can run any kind of code in parallel with -e / --exec
228
228
 
229
229
  TIPS
230
230
  ====
231
+ - `--first-is-1` or `export PARALLEL_TEST_FIRST_IS_1=true` will make the first environment be `1`, so you can test while running your full suite
232
+ - Debug errors that only happen with multiple files using `--verbose` and [cleanser](https://github.com/grosser/cleanser)
231
233
  - [RSpec] add a `.rspec_parallel` to use different options, e.g. **no --drb**
232
- - Spring does not work with parallel_tests, use `DISABLE_SPRING=1 rake parallel:spec` if you have spring hardcoded in your binaries
233
234
  - [RSpec] remove `--loadby` from `.rspec`
234
235
  - [RSpec] Instantly see failures (instead of just a red F) with [rspec-instafail](https://github.com/grosser/rspec-instafail)
235
236
  - [RSpec] use [rspec-retry](https://github.com/NoRedInk/rspec-retry) (not rspec-rerun) to rerun failed tests.
@@ -238,13 +239,12 @@ TIPS
238
239
  - [Sphinx setup](https://github.com/grosser/parallel_tests/wiki)
239
240
  - [Capistrano setup](https://github.com/grosser/parallel_tests/wiki/Remotely-with-capistrano) let your tests run on a big box instead of your laptop
240
241
  - [SQL schema format] use :ruby schema format to get faster parallel:prepare`
241
- - `export PARALLEL_TEST_PROCESSORS=X` in your environment and parallel_tests will use this number of processors by default
242
242
  - [ZSH] use quotes to use rake arguments `rake "parallel:prepare[3]"`
243
243
  - [email_spec and/or action_mailer_cache_delivery](https://github.com/grosser/parallel_tests/wiki)
244
244
  - [Memcached] use different namespaces e.g. `config.cache_store = ..., namespace: "test_#{ENV['TEST_ENV_NUMBER']}"`
245
245
  - [zeus-parallel_tests](https://github.com/sevos/zeus-parallel_tests)
246
246
  - [Distributed parallel test (e.g. Travis Support)](https://github.com/grosser/parallel_tests/wiki/Distributed-Parallel-Tests-and-Travis-Support)
247
- - Debug errors that only happen with multiple files using `--verbose` and [cleanser](https://github.com/grosser/cleanser)
247
+ - `export PARALLEL_TEST_PROCESSORS=13` to override default processor count
248
248
  - Shell alias: `alias prspec='parallel_rspec -m 2 --'`
249
249
  - [Spring] to use spring you have to [patch it](https://github.com/grosser/parallel_tests/wiki/Spring)
250
250
  - Contribute your own gotaches to the [Wiki](https://github.com/grosser/parallel_tests/wiki) or even better open a PR :)
@@ -257,7 +257,7 @@ TODO
257
257
 
258
258
  Authors
259
259
  ====
260
- inspired by [pivotal labs](http://pivotallabs.com/users/miked/blog/articles/849-parallelize-your-rspec-suite)
260
+ inspired by [pivotal labs](https://blog.pivotal.io/labs/labs/parallelize-your-rspec-suite)
261
261
 
262
262
  ### [Contributors](https://github.com/grosser/parallel_tests/contributors)
263
263
  - [Charles Finkel](http://charlesfinkel.com/)
@@ -41,7 +41,7 @@ module ParallelTests
41
41
  end
42
42
 
43
43
  def first_process?
44
- !ENV["TEST_ENV_NUMBER"] || ENV["TEST_ENV_NUMBER"].to_i == 0
44
+ ENV["TEST_ENV_NUMBER"].to_i <= 1
45
45
  end
46
46
 
47
47
  def wait_for_other_processes_to_finish
@@ -13,6 +13,8 @@ module ParallelTests
13
13
  num_processes = ParallelTests.determine_number_of_processes(options[:count])
14
14
  num_processes = num_processes * (options[:multiply] || 1)
15
15
 
16
+ options[:first_is_1] ||= first_is_1?
17
+
16
18
  if options[:execute]
17
19
  execute_shell_command_in_parallel(options[:execute], num_processes, options)
18
20
  else
@@ -190,6 +192,7 @@ module ParallelTests
190
192
  opts.on("--runtime-log [PATH]", "Location of previously recorded test runtimes") { |path| options[:runtime_log] = path }
191
193
  opts.on("--allowed-missing [INT]", Integer, "Allowed percentage of missing runtimes (default = 50)") { |percent| options[:allowed_missing_percent] = percent }
192
194
  opts.on("--unknown-runtime [FLOAT]", Float, "Use given number as unknown runtime (otherwise use average time)") { |time| options[:unknown_runtime] = time }
195
+ opts.on("--first-is-1", "Use \"1\" as TEST_ENV_NUMBER to not reuse the default test environment") { options[:first_is_1] = true }
193
196
  opts.on("--verbose", "Print more output") { options[:verbose] = true }
194
197
  opts.on("-v", "--version", "Show Version") { puts ParallelTests::VERSION; exit }
195
198
  opts.on("-h", "--help", "Show this.") { puts opts; exit }
@@ -286,5 +289,10 @@ module ParallelTests
286
289
  def use_colors?
287
290
  $stdout.tty?
288
291
  end
292
+
293
+ def first_is_1?
294
+ val = ENV["PARALLEL_TEST_FIRST_IS_1"]
295
+ ['1', 'true'].include?(val)
296
+ end
289
297
  end
290
298
  end
@@ -71,7 +71,7 @@ module ParallelTests
71
71
 
72
72
  def execute_command(cmd, process_number, num_processes, options)
73
73
  env = (options[:env] || {}).merge(
74
- "TEST_ENV_NUMBER" => test_env_number(process_number),
74
+ "TEST_ENV_NUMBER" => test_env_number(process_number, options),
75
75
  "PARALLEL_TEST_GROUPS" => num_processes
76
76
  )
77
77
  cmd = "nice #{cmd}" if options[:nice]
@@ -108,8 +108,12 @@ module ParallelTests
108
108
  }.compact
109
109
  end
110
110
 
111
- def test_env_number(process_number)
112
- process_number == 0 ? '' : process_number + 1
111
+ def test_env_number(process_number, options={})
112
+ if process_number == 0 && !options[:first_is_1]
113
+ ''
114
+ else
115
+ process_number + 1
116
+ end
113
117
  end
114
118
 
115
119
  def summarize_results(results)
@@ -1,3 +1,3 @@
1
1
  module ParallelTests
2
- VERSION = Version = '2.2.2'
2
+ VERSION = Version = '2.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-03 00:00:00.000000000 Z
11
+ date: 2016-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel