parallel_tests 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +7 -4
- data/VERSION +1 -1
- data/lib/parallel_tests.rb +3 -1
- data/lib/parallel_tests/tasks.rb +1 -1
- data/parallel_tests.gemspec +2 -2
- data/spec/parallel_tests_spec.rb +11 -0
- metadata +4 -4
data/Readme.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
Speedup Test::Unit + RSpec + Cucumber by running parallel on multiple CPUs (or cores)
|
1
|
+
Speedup Test::Unit + RSpec + Cucumber by running parallel on multiple CPUs (or cores).<br/>
|
2
|
+
ParallelTests splits tests into even groups and runs each group in a single process with its own database.
|
2
3
|
|
3
4
|
Setup for Rails
|
4
5
|
===============
|
@@ -41,6 +42,9 @@ OR as plugin
|
|
41
42
|
./script/plugin install git://github.com/grosser/parallel_tests.git
|
42
43
|
|
43
44
|
## Setup
|
45
|
+
ParallelTests uses 1 database per test-process, 2 processes will use `*_test` and `*_test2`.
|
46
|
+
|
47
|
+
|
44
48
|
### 1: Add to `config/database.yml`
|
45
49
|
test:
|
46
50
|
database: xxx_test<%= ENV['TEST_ENV_NUMBER'] %>
|
@@ -61,7 +65,7 @@ OR as plugin
|
|
61
65
|
rake parallel:test --> got 4 CPUs? --> 26 seconds
|
62
66
|
...
|
63
67
|
|
64
|
-
Test by pattern (e.g. use one integration server per subfolder / see if you broke any user-related tests)
|
68
|
+
Test by pattern (e.g. use one integration server per subfolder / see if you broke any 'user'-related tests)
|
65
69
|
|
66
70
|
rake parallel:test[^unit] # everything in test/unit folder (every test file matching /^unit/)
|
67
71
|
rake parallel:test[user] # run users_controller + user_helper + user tests
|
@@ -73,8 +77,6 @@ Example output
|
|
73
77
|
2 processes for 210 specs, ~ 105 specs per process
|
74
78
|
... test output ...
|
75
79
|
|
76
|
-
Results:
|
77
|
-
877 examples, 0 failures, 11 pending
|
78
80
|
843 examples, 0 failures, 1 pending
|
79
81
|
|
80
82
|
Took 29.925333 seconds
|
@@ -211,6 +213,7 @@ inspired by [pivotal labs](http://pivotallabs.com/users/miked/blog/articles/849-
|
|
211
213
|
- [nathansobo](https://github.com/nathansobo)
|
212
214
|
- [Joe Yates](http://titusd.co.uk)
|
213
215
|
- [asmega](http://www.ph-lee.com)
|
216
|
+
- [Doug Barth](https://github.com/dougbarth)
|
214
217
|
|
215
218
|
[Michael Grosser](http://grosser.it)<br/>
|
216
219
|
michael@grosser.it<br/>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.2
|
data/lib/parallel_tests.rb
CHANGED
@@ -14,7 +14,9 @@ class ParallelTests
|
|
14
14
|
# parallel:spec[2,models,options]
|
15
15
|
# parallel:spec[,models,options]
|
16
16
|
count = args.shift if args.first.to_s =~ /^\d*$/
|
17
|
-
num_processes =
|
17
|
+
num_processes = count.to_i unless count.to_s.empty?
|
18
|
+
num_processes ||= ENV['PARALLEL_TEST_PROCESSORS'].to_i if ENV['PARALLEL_TEST_PROCESSORS']
|
19
|
+
num_processes ||= Parallel.processor_count
|
18
20
|
|
19
21
|
pattern = args.shift
|
20
22
|
options = args.shift
|
data/lib/parallel_tests/tasks.rb
CHANGED
@@ -30,7 +30,7 @@ namespace :parallel do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
# when dumping/resetting takes too long
|
33
|
-
desc "update test databases via db:
|
33
|
+
desc "update test databases via db:migrate --> parallel:migrate[num_cpus]"
|
34
34
|
task :migrate, :count do |t,args|
|
35
35
|
run_in_parallel('rake db:migrate RAILS_ENV=test', args)
|
36
36
|
end
|
data/parallel_tests.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{parallel_tests}
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.2"
|
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{2011-
|
12
|
+
s.date = %q{2011-09-15}
|
13
13
|
s.email = %q{grosser.michael@gmail.com}
|
14
14
|
s.executables = ["parallel_cucumber", "parallel_test", "parallel_spec"]
|
15
15
|
s.files = [
|
data/spec/parallel_tests_spec.rb
CHANGED
@@ -23,6 +23,17 @@ describe ParallelTests do
|
|
23
23
|
args = {:count => 2, :pattern => "plain", :options => "-p default" }
|
24
24
|
ParallelTests.parse_rake_args(args).should == [2, "plain", "-p default"]
|
25
25
|
end
|
26
|
+
|
27
|
+
it "should use the PARALLEL_TEST_PROCESSORS env var for processor_count if set" do
|
28
|
+
ENV['PARALLEL_TEST_PROCESSORS'] = '28'
|
29
|
+
ParallelTests.parse_rake_args({}).should == [28, '', '']
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should use count over PARALLEL_TEST_PROCESSORS env var" do
|
33
|
+
ENV['PARALLEL_TEST_PROCESSORS'] = '28'
|
34
|
+
args = {:count => 2}
|
35
|
+
ParallelTests.parse_rake_args(args).should == [2, '', ""]
|
36
|
+
end
|
26
37
|
end
|
27
38
|
|
28
39
|
describe :run_tests do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel_tests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 2
|
10
|
+
version: 0.6.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Grosser
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-09-15 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|