parallel_tests 0.8.11 → 0.8.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/lib/parallel_tests/tasks.rb +25 -6
- data/lib/parallel_tests/version.rb +1 -1
- metadata +3 -3
data/Gemfile.lock
CHANGED
data/lib/parallel_tests/tasks.rb
CHANGED
@@ -8,6 +8,29 @@ namespace :parallel do
|
|
8
8
|
abort unless system(command)
|
9
9
|
end
|
10
10
|
|
11
|
+
# this is a crazy-complex solution for a very simple problem:
|
12
|
+
# removing certain lines from the output without chaning the exit-status
|
13
|
+
# normally I'd not do this, but it has been lots of fun and a great learning experience :)
|
14
|
+
#
|
15
|
+
# - sed does not support | without -r
|
16
|
+
# - grep changes 0 exitstatus to 1 if nothing matches
|
17
|
+
# - sed changes 1 exitstatus to 0
|
18
|
+
# - pipefail makes pipe fail with exitstatus of first failed command
|
19
|
+
# - pipefail is not supported in (zsh)
|
20
|
+
# - defining a new rake task like silence_schema would force users to load parallel_tests in test env
|
21
|
+
# - do not use ' since run_in_parallel uses them to quote stuff
|
22
|
+
# - simple system "set -o pipefail" returns nil even though set -o pipefail exists with 0
|
23
|
+
def parallel_tests_suppress_output(command, ignore_regex)
|
24
|
+
activate_pipefail = "set -o pipefail"
|
25
|
+
remove_ignored_lines = %Q{(grep -v "#{ignore_regex}" || test 1)}
|
26
|
+
|
27
|
+
if system("#{activate_pipefail} && test 1")
|
28
|
+
"#{activate_pipefail} && (#{command}) | #{remove_ignored_lines}"
|
29
|
+
else
|
30
|
+
command
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
11
34
|
desc "create test databases via db:create --> parallel:create[num_cpus]"
|
12
35
|
task :create, :count do |t,args|
|
13
36
|
run_in_parallel("rake db:create RAILS_ENV=#{rails_env}", args)
|
@@ -40,12 +63,8 @@ namespace :parallel do
|
|
40
63
|
# just load the schema (good for integration server <-> no development db)
|
41
64
|
desc "load dumped schema for test databases via db:schema:load --> parallel:load_schema[num_cpus]"
|
42
65
|
task :load_schema, :count do |t,args|
|
43
|
-
|
44
|
-
|
45
|
-
# without pipefail parallel:prepare would exit 0 even if it failed due to sed exiting with 0
|
46
|
-
# defining a new rake task like silence_schema would force users to load parallel_tests in test env
|
47
|
-
suppress_schema_noise = '| sed "/^-- /d" | sed "/^ ->/d"'
|
48
|
-
run_in_parallel("set -o pipefail ; rake db:schema:load RAILS_ENV=#{rails_env} #{suppress_schema_noise}", args)
|
66
|
+
command = "rake db:schema:load RAILS_ENV=#{rails_env}"
|
67
|
+
run_in_parallel(parallel_tests_suppress_output(command, "^ ->\\|^-- "), args)
|
49
68
|
end
|
50
69
|
|
51
70
|
desc "load the seed data from db/seeds.rb via db:seed --> parallel:seed[num_cpus]"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel_tests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.12
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -90,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
segments:
|
92
92
|
- 0
|
93
|
-
hash: -
|
93
|
+
hash: -2655389699589220897
|
94
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
segments:
|
101
101
|
- 0
|
102
|
-
hash: -
|
102
|
+
hash: -2655389699589220897
|
103
103
|
requirements: []
|
104
104
|
rubyforge_project:
|
105
105
|
rubygems_version: 1.8.24
|