parallel_tests 2.29.2 → 2.30.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
  SHA256:
3
- metadata.gz: 68ba592f56ce42eab34cf1c1691bfde23de8ded652d9b171880bdadb1573a92e
4
- data.tar.gz: f5438fa50a6e072b0074dc25724e9533912f120bc8d8537ccd76fd83e15988ec
3
+ metadata.gz: 4583a8f40bb8759f5c8bb3e0f17771a10909385bd93846162e2d636faa18b4f1
4
+ data.tar.gz: 59798e0156b9bc5461d4fdae181d02cea5035265af3a7cd45517cbaee74c826e
5
5
  SHA512:
6
- metadata.gz: bc8d70e18409b6dc5d67065e0854f9873c63c8097d64f8d81237e896a9878e614c1eed741a4f2235f85553af42745509d7d4b7f3a4c044b8f057aef1bcddd0d7
7
- data.tar.gz: 4626db276c737f3daee5b37837bdee6466791ec440c267a6781eb1341d52db8afba19e56e2c8c212cbe58d994d47a88a53d534645313bd717a7e3f88878b5f7a
6
+ metadata.gz: c3bceb2a75be6d0e3c65b65a728f8b89f7c1b705c93d7b6e23f7e9cc345bff8dd13d56f9db638c64a55f463d7ca39cf58488e34724e37e906f4713345528ff1f
7
+ data.tar.gz: bff90557bf81bb0f1584f6d209c7623aba2ca673c51fc3a10c60ea18655c72826f95bd66326e4368f765d6424daf5ded005bf613088e146ee27735103cd44dc0
data/Readme.md CHANGED
@@ -266,14 +266,13 @@ TIPS
266
266
  - Builds a HTML report from JSON with support for debug msgs & embedded Base64 images.
267
267
 
268
268
  ### General
269
- - [SQL schema format] use :ruby schema format to get faster parallel:prepare`
270
269
  - [ZSH] use quotes to use rake arguments `rake "parallel:prepare[3]"`
271
270
  - [Memcached] use different namespaces<br/>
272
271
  e.g. `config.cache_store = ..., namespace: "test_#{ENV['TEST_ENV_NUMBER']}"`
273
272
  - Debug errors that only happen with multiple files using `--verbose` and [cleanser](https://github.com/grosser/cleanser)
274
273
  - `export PARALLEL_TEST_PROCESSORS=13` to override default processor count
275
274
  - Shell alias: `alias prspec='parallel_rspec -m 2 --'`
276
- - [Spring] to use spring you have to [patch it](https://github.com/grosser/parallel_tests/wiki/Spring)
275
+ - [Spring] Add the [spring-commands-parallel-tests](https://github.com/DocSpring/spring-commands-parallel-tests) gem to your `Gemfile` to get `parallel_tests` working with Spring.
277
276
  - `--first-is-1` will make the first environment be `1`, so you can test while running your full suite.<br/>
278
277
  `export PARALLEL_TEST_FIRST_IS_1=true` will provide the same result
279
278
  - [email_spec and/or action_mailer_cache_delivery](https://github.com/grosser/parallel_tests/wiki)
@@ -373,6 +372,7 @@ inspired by [pivotal labs](https://blog.pivotal.io/labs/labs/parallelize-your-rs
373
372
  - [Sandeep Singh](https://github.com/sandeepnagra)
374
373
  - [Calaway](https://github.com/calaway)
375
374
  - [alboyadjian](https://github.com/alboyadjian)
375
+ - [Nathan Broadbent](https://github.com/ndbroadbent)
376
376
 
377
377
  [Michael Grosser](http://grosser.it)<br/>
378
378
  michael@grosser.it<br/>
@@ -8,6 +8,14 @@ module ParallelTests
8
8
  ENV['RAILS_ENV'] || 'test'
9
9
  end
10
10
 
11
+ def rake_bin
12
+ # Prevent 'Exec format error' Errno::ENOEXEC on Windows
13
+ return "rake" if RUBY_PLATFORM =~ /mswin|mingw|cygwin/
14
+ binstub_path = File.join('bin', 'rake')
15
+ return binstub_path if File.exist?(binstub_path)
16
+ "rake"
17
+ end
18
+
11
19
  def load_lib
12
20
  $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), '..'))
13
21
  require "parallel_tests"
@@ -89,67 +97,84 @@ end
89
97
  namespace :parallel do
90
98
  desc "Setup test databases via db:setup --> parallel:setup[num_cpus]"
91
99
  task :setup, :count do |_,args|
92
- command = "rake db:setup RAILS_ENV=#{ParallelTests::Tasks.rails_env}"
100
+ command = "#{ParallelTests::Tasks.rake_bin} db:setup RAILS_ENV=#{ParallelTests::Tasks.rails_env}"
93
101
  ParallelTests::Tasks.run_in_parallel(ParallelTests::Tasks.suppress_schema_load_output(command), args)
94
102
  end
95
103
 
96
104
  desc "Create test databases via db:create --> parallel:create[num_cpus]"
97
105
  task :create, :count do |_,args|
98
- ParallelTests::Tasks.run_in_parallel("rake db:create RAILS_ENV=#{ParallelTests::Tasks.rails_env}", args)
106
+ ParallelTests::Tasks.run_in_parallel(
107
+ "#{ParallelTests::Tasks.rake_bin} db:create RAILS_ENV=#{ParallelTests::Tasks.rails_env}", args)
99
108
  end
100
109
 
101
110
  desc "Drop test databases via db:drop --> parallel:drop[num_cpus]"
102
111
  task :drop, :count do |_,args|
103
- ParallelTests::Tasks.run_in_parallel("rake db:drop RAILS_ENV=#{ParallelTests::Tasks.rails_env} DISABLE_DATABASE_ENVIRONMENT_CHECK=1", args)
112
+ ParallelTests::Tasks.run_in_parallel(
113
+ "#{ParallelTests::Tasks.rake_bin} db:drop RAILS_ENV=#{ParallelTests::Tasks.rails_env} " \
114
+ "DISABLE_DATABASE_ENVIRONMENT_CHECK=1", args)
104
115
  end
105
116
 
106
117
  desc "Update test databases by dumping and loading --> parallel:prepare[num_cpus]"
107
118
  task(:prepare, [:count]) do |_,args|
108
119
  ParallelTests::Tasks.check_for_pending_migrations
109
- if defined?(ActiveRecord) && ActiveRecord::Base.schema_format == :ruby
110
- # dump then load in parallel
111
- Rake::Task['db:schema:dump'].invoke
112
- Rake::Task['parallel:load_schema'].invoke(args[:count])
120
+ if defined?(ActiveRecord::Base) && [:ruby, :sql].include?(ActiveRecord::Base.schema_format)
121
+ # fast: dump once, load in parallel
122
+ type = (ActiveRecord::Base.schema_format == :ruby ? "schema" : "structure")
123
+ Rake::Task["db:#{type}:dump"].invoke
124
+
125
+ # remove database connection to prevent "database is being accessed by other users"
126
+ ActiveRecord::Base.remove_connection if ActiveRecord::Base.configurations.any?
127
+
128
+ Rake::Task["parallel:load_#{type}"].invoke(args[:count])
113
129
  else
114
- # there is no separate dump / load for schema_format :sql -> do it safe and slow
130
+ # slow: dump and load in in serial
115
131
  args = args.to_hash.merge(:non_parallel => true) # normal merge returns nil
116
- taskname = Rake::Task.task_defined?('db:test:prepare') ? 'db:test:prepare' : 'app:db:test:prepare'
117
- ParallelTests::Tasks.run_in_parallel("rake #{taskname}", args)
132
+ task_name = Rake::Task.task_defined?('db:test:prepare') ? 'db:test:prepare' : 'app:db:test:prepare'
133
+ ParallelTests::Tasks.run_in_parallel("#{ParallelTests::Tasks.rake_bin} #{task_name}", args)
134
+ next
118
135
  end
119
136
  end
120
137
 
121
138
  # when dumping/resetting takes too long
122
139
  desc "Update test databases via db:migrate --> parallel:migrate[num_cpus]"
123
140
  task :migrate, :count do |_,args|
124
- ParallelTests::Tasks.run_in_parallel("rake db:migrate RAILS_ENV=#{ParallelTests::Tasks.rails_env}", args)
141
+ ParallelTests::Tasks.run_in_parallel(
142
+ "#{ParallelTests::Tasks.rake_bin} db:migrate RAILS_ENV=#{ParallelTests::Tasks.rails_env}", args)
125
143
  end
126
144
 
127
145
  desc "Rollback test databases via db:rollback --> parallel:rollback[num_cpus]"
128
146
  task :rollback, :count do |_,args|
129
- ParallelTests::Tasks.run_in_parallel("rake db:rollback RAILS_ENV=#{ParallelTests::Tasks.rails_env}", args)
147
+ ParallelTests::Tasks.run_in_parallel(
148
+ "#{ParallelTests::Tasks.rake_bin} db:rollback RAILS_ENV=#{ParallelTests::Tasks.rails_env}", args)
130
149
  end
131
150
 
132
151
  # just load the schema (good for integration server <-> no development db)
133
152
  desc "Load dumped schema for test databases via db:schema:load --> parallel:load_schema[num_cpus]"
134
153
  task :load_schema, :count do |_,args|
135
- command = "rake #{ParallelTests::Tasks.purge_before_load} db:schema:load RAILS_ENV=#{ParallelTests::Tasks.rails_env} DISABLE_DATABASE_ENVIRONMENT_CHECK=1"
154
+ command = "#{ParallelTests::Tasks.rake_bin} #{ParallelTests::Tasks.purge_before_load} " \
155
+ "db:schema:load RAILS_ENV=#{ParallelTests::Tasks.rails_env} DISABLE_DATABASE_ENVIRONMENT_CHECK=1"
136
156
  ParallelTests::Tasks.run_in_parallel(ParallelTests::Tasks.suppress_schema_load_output(command), args)
137
157
  end
138
158
 
139
159
  # load the structure from the structure.sql file
140
160
  desc "Load structure for test databases via db:structure:load --> parallel:load_structure[num_cpus]"
141
161
  task :load_structure, :count do |_,args|
142
- ParallelTests::Tasks.run_in_parallel("rake #{ParallelTests::Tasks.purge_before_load} db:structure:load RAILS_ENV=#{ParallelTests::Tasks.rails_env} DISABLE_DATABASE_ENVIRONMENT_CHECK=1", args)
162
+ ParallelTests::Tasks.run_in_parallel(
163
+ "#{ParallelTests::Tasks.rake_bin} #{ParallelTests::Tasks.purge_before_load} " \
164
+ "db:structure:load RAILS_ENV=#{ParallelTests::Tasks.rails_env} DISABLE_DATABASE_ENVIRONMENT_CHECK=1", args)
143
165
  end
144
166
 
145
167
  desc "Load the seed data from db/seeds.rb via db:seed --> parallel:seed[num_cpus]"
146
168
  task :seed, :count do |_,args|
147
- ParallelTests::Tasks.run_in_parallel("rake db:seed RAILS_ENV=#{ParallelTests::Tasks.rails_env}", args)
169
+ ParallelTests::Tasks.run_in_parallel(
170
+ "#{ParallelTests::Tasks.rake_bin} db:seed RAILS_ENV=#{ParallelTests::Tasks.rails_env}", args)
148
171
  end
149
172
 
150
173
  desc "Launch given rake command in parallel"
151
174
  task :rake, :command, :count do |_, args|
152
- ParallelTests::Tasks.run_in_parallel("RAILS_ENV=#{ParallelTests::Tasks.rails_env} rake #{args.command}", args)
175
+ ParallelTests::Tasks.run_in_parallel(
176
+ "RAILS_ENV=#{ParallelTests::Tasks.rails_env} #{ParallelTests::Tasks.rake_bin} " \
177
+ "#{args.command}", args)
153
178
  end
154
179
 
155
180
  ['test', 'spec', 'features', 'features-spinach'].each do |type|
@@ -172,7 +197,8 @@ namespace :parallel do
172
197
  # Using the relative path to find the binary allow to run a specific version of it
173
198
  executable = File.join(File.dirname(__FILE__), '..', '..', 'bin', 'parallel_test')
174
199
 
175
- command = "#{ParallelTests.with_ruby_binary(Shellwords.escape(executable))} #{type} --type #{test_framework} " \
200
+ command = "#{ParallelTests.with_ruby_binary(Shellwords.escape(executable))} #{type} " \
201
+ "--type #{test_framework} " \
176
202
  "-n #{count} " \
177
203
  "--pattern '#{pattern}' " \
178
204
  "--test-options '#{options}' " \
@@ -1,3 +1,3 @@
1
1
  module ParallelTests
2
- VERSION = Version = '2.29.2'
2
+ VERSION = Version = '2.30.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.29.2
4
+ version: 2.30.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: 2019-08-06 00:00:00.000000000 Z
11
+ date: 2019-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel