parallel_tests 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.3
@@ -1,31 +1,33 @@
1
1
  namespace :parallel do
2
- desc "update test databases by running db:test:prepare for each --> parallel:prepare[num_cpus]"
3
- task :prepare, :count do |t,args|
4
- require File.join(File.dirname(__FILE__), '..', 'lib', "parallel_tests")
2
+ def run_in_parallel(cmd, options)
3
+ count = (options[:count] ? options[:count].to_i : nil)
4
+ system "#{File.join(File.dirname(__FILE__), '..', '..', 'bin', 'parallel_test')} --exec '#{cmd}' -n #{count}"
5
+ end
5
6
 
6
- Parallel.in_processes(args[:count] ? args[:count].to_i : nil) do |i|
7
- puts "Preparing test database #{i + 1}"
8
- exec "export TEST_ENV_NUMBER=#{ParallelTests.test_env_number(i)} ; rake db:test:prepare"
9
- end
7
+ desc "update test databases by running db:test:prepare for each test db --> parallel:prepare[num_cpus]"
8
+ task :prepare, :count do |t,args|
9
+ run_in_parallel('rake db:test:prepare', args)
10
10
  end
11
11
 
12
- # Useful when dumping/resetting takes too long
13
- desc "update test databases by running db:mgrate for each --> parallel:migrate[num_cpus]"
12
+ # when dumping/resetting takes too long
13
+ desc "update test databases by running db:mgrate for each test db --> parallel:migrate[num_cpus]"
14
14
  task :migrate, :count do |t,args|
15
- require File.join(File.dirname(__FILE__), '..', 'lib', "parallel_tests")
15
+ run_in_parallel('rake db:migrate RAILS_ENV=test', args)
16
+ end
16
17
 
17
- Parallel.in_processes(args[:count] ? args[:count].to_i : nil) do |i|
18
- puts "Migrating test database #{i + 1}"
19
- exec "export TEST_ENV_NUMBER=#{ParallelTests.test_env_number(i)} ; rake db:migrate RAILS_ENV=test"
20
- end
18
+ # Do not want a development db on integration server.
19
+ # and always dump a complete schema ?
20
+ desc "load dumped schema for each test db --> parallel:load_schema[num_cpus]"
21
+ task :load_schema, :count do |t,args|
22
+ run_in_parallel('rake db:schema:load RAILS_ENV=test', args)
21
23
  end
22
24
 
23
25
  ['test', 'spec', 'features'].each do |type|
24
26
  desc "run #{type} in parallel with parallel:#{type}[num_cpus]"
25
27
  task type, :count, :path_prefix, :options do |t,args|
26
- require File.join(File.dirname(__FILE__), '..', 'lib', "parallel_tests")
28
+ require File.join(File.dirname(__FILE__), '..', "parallel_tests")
27
29
  count, prefix, options = ParallelTests.parse_rake_args(args)
28
- exec "#{File.join(File.dirname(__FILE__), '..', 'bin', 'parallel_test')} --type #{type} -n #{count} -p '#{prefix}' -r '#{RAILS_ROOT}' -o '#{options}'"
30
+ exec "#{File.join(File.dirname(__FILE__), '..', '..', 'bin', 'parallel_test')} --type #{type} -n #{count} -p '#{prefix}' -r '#{RAILS_ROOT}' -o '#{options}'"
29
31
  end
30
32
  end
31
33
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{parallel_tests}
8
- s.version = "0.3.2"
8
+ s.version = "0.3.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Grosser"]
12
- s.date = %q{2010-03-09}
12
+ s.date = %q{2010-03-23}
13
13
  s.email = %q{grosser.michael@gmail.com}
14
14
  s.executables = ["parallel_test", "parallel_spec", "parallel_cucumber"]
15
15
  s.extra_rdoc_files = [
@@ -27,13 +27,13 @@ Gem::Specification.new do |s|
27
27
  "lib/parallel_specs.rb",
28
28
  "lib/parallel_specs/spec_runtime_logger.rb",
29
29
  "lib/parallel_tests.rb",
30
+ "lib/tasks/parallel_tests.rake",
30
31
  "parallel_tests.gemspec",
31
32
  "spec/integration_spec.rb",
32
33
  "spec/parallel_cucumber_spec.rb",
33
34
  "spec/parallel_specs_spec.rb",
34
35
  "spec/parallel_tests_spec.rb",
35
- "spec/spec_helper.rb",
36
- "tasks/parallel_tests.rake"
36
+ "spec/spec_helper.rb"
37
37
  ]
38
38
  s.homepage = %q{http://github.com/grosser/parallel_tests}
39
39
  s.rdoc_options = ["--charset=UTF-8"]
@@ -78,6 +78,7 @@ describe 'CLI' do
78
78
  write 'xxx6_spec.rb', 'describe("it"){it("should"){sleep 2}}'
79
79
  t = Time.now
80
80
  run_specs :processes => 6
81
- (Time.now - t).should < (Parallel.processor_count == 1 ? 10 : 5)
81
+ expected = ((Parallel.processor_count == 1 or ENV['RUN_CODE_RUN']) ? 10 : 5)
82
+ (Time.now - t).should <= expected
82
83
  end
83
84
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 2
9
- version: 0.3.2
8
+ - 3
9
+ version: 0.3.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michael Grosser
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-09 00:00:00 +01:00
17
+ date: 2010-03-23 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -51,13 +51,13 @@ files:
51
51
  - lib/parallel_specs.rb
52
52
  - lib/parallel_specs/spec_runtime_logger.rb
53
53
  - lib/parallel_tests.rb
54
+ - lib/tasks/parallel_tests.rake
54
55
  - parallel_tests.gemspec
55
56
  - spec/integration_spec.rb
56
57
  - spec/parallel_cucumber_spec.rb
57
58
  - spec/parallel_specs_spec.rb
58
59
  - spec/parallel_tests_spec.rb
59
60
  - spec/spec_helper.rb
60
- - tasks/parallel_tests.rake
61
61
  has_rdoc: true
62
62
  homepage: http://github.com/grosser/parallel_tests
63
63
  licenses: []