parallelized_specs 0.3.78 → 0.3.79
Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile
CHANGED
@@ -12,7 +12,7 @@ begin
|
|
12
12
|
gem.email = "jake@instructure.com"
|
13
13
|
gem.homepage = "http://github.com/jakesorce/#{gem.name}"
|
14
14
|
gem.authors = "Jake Sorce, Bryan Madsen, Shawn Meredith"
|
15
|
-
gem.version = "0.3.
|
15
|
+
gem.version = "0.3.79"
|
16
16
|
end
|
17
17
|
Jeweler::GemcutterTasks.new
|
18
18
|
rescue LoadError
|
@@ -4,15 +4,6 @@ require 'parallelized_specs/spec_logger_base'
|
|
4
4
|
module RSpec
|
5
5
|
class ParallelizedSpecs::FailuresFormatter < ParallelizedSpecs::SpecLoggerBase
|
6
6
|
|
7
|
-
def start(example_count)
|
8
|
-
@example_count = example_count
|
9
|
-
env_test_number = ENV['TEST_ENV_NUMBER']
|
10
|
-
env_test_number = 1 if ENV['TEST_ENV_NUMBER'].blank?
|
11
|
-
puts "Thread #{env_test_number.to_s} has #{@example_count} specs"
|
12
|
-
File.open("tmp/parallel_log/spec_count/total_specs#{env_test_number}.txt", 'a+') { |f| f.write(@example_count) }
|
13
|
-
super
|
14
|
-
end
|
15
|
-
|
16
7
|
def example_failed(example, counter, failure)
|
17
8
|
lock_output do
|
18
9
|
@output.puts retry_command(example)
|
@@ -20,16 +11,7 @@ module RSpec
|
|
20
11
|
end
|
21
12
|
|
22
13
|
def dump_summary(duration, example_count, failure_count, pending_count)
|
23
|
-
|
24
|
-
env_test_number = 1 if ENV['TEST_ENV_NUMBER'].blank?
|
25
|
-
spec_file = "tmp/parallel_log/spec_count/total_specs#{env_test_number}.txt"
|
26
|
-
failure_file = "tmp/parallel_log/failed_specs/failed_specs#{env_test_number}.txt"
|
27
|
-
before_example_count = File.open(spec_file, &:readline).to_s
|
28
|
-
puts "From the file example count = #{before_example_count} from rspec example count = #{example_count}"
|
29
|
-
File.delete(spec_file) if before_example_count.to_i == example_count.to_i
|
30
|
-
puts "Thead Failure count = #{failure_count}"
|
31
|
-
failure_count > 0 ? (File.open(failure_file, 'a+') { |f| f.write(failure_count) }) : (puts "All specs in Thread #{env_test_number} passed")
|
32
|
-
puts "Thread #{env_test_number} has completed"
|
14
|
+
;
|
33
15
|
end
|
34
16
|
|
35
17
|
def dump_failures(*args)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'parallelized_specs/spec_logger_base'
|
2
|
+
|
3
|
+
module RSpec
|
4
|
+
|
5
|
+
class ParallelizedSpecs::OutcomeBuilder < ParallelizedSpecs::SpecLoggerBase
|
6
|
+
|
7
|
+
def start(example_count)
|
8
|
+
@example_count = example_count
|
9
|
+
env_test_number = ENV['TEST_ENV_NUMBER']
|
10
|
+
env_test_number = 1 if ENV['TEST_ENV_NUMBER'].blank?
|
11
|
+
puts "Thread #{env_test_number.to_s} has #{@example_count} specs"
|
12
|
+
File.open("tmp/parallel_log/spec_count/total_specs#{env_test_number}.txt", 'a+') { |f| f.write(@example_count) }
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def dump_summary(duration, example_count, failure_count, pending_count)
|
18
|
+
env_test_number = ENV['TEST_ENV_NUMBER']
|
19
|
+
env_test_number = 1 if ENV['TEST_ENV_NUMBER'].blank?
|
20
|
+
spec_file = "tmp/parallel_log/spec_count/total_specs#{env_test_number}.txt"
|
21
|
+
failure_file = "tmp/parallel_log/failed_specs/failed_specs#{env_test_number}.txt"
|
22
|
+
before_example_count = File.open(spec_file, &:readline).to_s
|
23
|
+
puts "Expected example count = #{before_example_count} from rspec example count = #{example_count}"
|
24
|
+
File.delete(spec_file) if before_example_count.to_i == example_count.to_i
|
25
|
+
puts "Thread example failure count = #{failure_count}"
|
26
|
+
failure_count > 0 ? (File.open(failure_file, 'a+') { |f| f.write(failure_count) }) : (puts "All specs in Thread #{env_test_number} passed")
|
27
|
+
puts "Thread #{env_test_number} has completed in #{duration}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def dump_failures(*args)
|
31
|
+
;
|
32
|
+
end
|
33
|
+
|
34
|
+
def dump_failure(*args)
|
35
|
+
;
|
36
|
+
end
|
37
|
+
|
38
|
+
def dump_pending(*args)
|
39
|
+
;
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/parallelized_specs.rb
CHANGED
@@ -5,7 +5,7 @@ require 'parallelized_specs/railtie'
|
|
5
5
|
require 'parallelized_specs/spec_error_logger'
|
6
6
|
require 'parallelized_specs/spec_error_count_logger'
|
7
7
|
require 'parallelized_specs/spec_start_finish_logger'
|
8
|
-
require 'parallelized_specs/
|
8
|
+
require 'parallelized_specs/outcome_builder'
|
9
9
|
require 'parallelized_specs/example_failures_logger'
|
10
10
|
require 'parallelized_specs/trending_example_failures_logger'
|
11
11
|
require 'parallelized_specs/failures_rerun_logger'
|
@@ -121,8 +121,7 @@ class ParallelizedSpecs
|
|
121
121
|
#exit with correct status code so rake parallel:test && echo 123 works
|
122
122
|
|
123
123
|
failed = test_results.any? { |result| result[:exit_status] != 0 } #ruby 1.8.7 works breaks on 1.9.3
|
124
|
-
puts "
|
125
|
-
puts "this is the exit status of the threads #{failed}"
|
124
|
+
puts "this is the exit status of the rspec suites #{failed}"
|
126
125
|
|
127
126
|
if Dir.glob('tmp/parallel_log/failed_specs/{*,.*}').count > 2 && FileTest.exist?("tmp/parallel_log/rspec.failures") # works on both 1.8.7\1.9.3
|
128
127
|
puts "some specs failed, about to start the rerun process\n no more than 9 specs may be rerun and shared specs are not allowed\n...\n..\n."
|
@@ -131,7 +130,6 @@ class ParallelizedSpecs
|
|
131
130
|
abort "#{name.capitalize}s Failed" if Dir.glob('tmp/parallel_log/failed_specs/{*,.*}').count > 2 || if failed #works on both 1.8.7\1.9.3
|
132
131
|
end
|
133
132
|
end
|
134
|
-
|
135
133
|
#this is getting run even if the rerun passes and causes triggers abort on successful reruns
|
136
134
|
puts "marking build as PASSED"
|
137
135
|
end
|
data/parallelized_specs.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "parallelized_specs"
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.79"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jake Sorce, Bryan Madsen, Shawn Meredith"]
|
12
|
-
s.date = "2012-12-
|
12
|
+
s.date = "2012-12-14"
|
13
13
|
s.email = "jake@instructure.com"
|
14
14
|
s.files = [
|
15
15
|
"Gemfile",
|
@@ -21,9 +21,9 @@ Gem::Specification.new do |s|
|
|
21
21
|
"lib/parallelized_specs/example_failures_logger.rb",
|
22
22
|
"lib/parallelized_specs/failures_rerun_logger.rb",
|
23
23
|
"lib/parallelized_specs/grouper.rb",
|
24
|
+
"lib/parallelized_specs/outcome_builder.rb",
|
24
25
|
"lib/parallelized_specs/railtie.rb",
|
25
26
|
"lib/parallelized_specs/runtime_logger.rb",
|
26
|
-
"lib/parallelized_specs/shared_example_failures_logger.rb",
|
27
27
|
"lib/parallelized_specs/spec_error_count_logger.rb",
|
28
28
|
"lib/parallelized_specs/spec_error_logger.rb",
|
29
29
|
"lib/parallelized_specs/spec_failures_logger.rb",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallelized_specs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 141
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 79
|
10
|
+
version: 0.3.79
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jake Sorce, Bryan Madsen, Shawn Meredith
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-12-
|
18
|
+
date: 2012-12-14 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: parallel
|
@@ -49,9 +49,9 @@ files:
|
|
49
49
|
- lib/parallelized_specs/example_failures_logger.rb
|
50
50
|
- lib/parallelized_specs/failures_rerun_logger.rb
|
51
51
|
- lib/parallelized_specs/grouper.rb
|
52
|
+
- lib/parallelized_specs/outcome_builder.rb
|
52
53
|
- lib/parallelized_specs/railtie.rb
|
53
54
|
- lib/parallelized_specs/runtime_logger.rb
|
54
|
-
- lib/parallelized_specs/shared_example_failures_logger.rb
|
55
55
|
- lib/parallelized_specs/spec_error_count_logger.rb
|
56
56
|
- lib/parallelized_specs/spec_error_logger.rb
|
57
57
|
- lib/parallelized_specs/spec_failures_logger.rb
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'parallelized_specs/spec_logger_base'
|
2
|
-
|
3
|
-
class ParallelizedSpecs::SharedExampleRerunFailuresLogger < ParallelizedSpecs::SpecLoggerBase
|
4
|
-
|
5
|
-
def example_failed(example, *args)
|
6
|
-
if RSPEC_1
|
7
|
-
if example.location != nil && example.location.match(/spec.*\d/).to_s != nil
|
8
|
-
@failed_shared_examples ||= {}
|
9
|
-
if !!self.example_group.nested_descriptions.to_s.match(/shared/) || !!self.instance_variable_get(:@example_group).examples.last.location.match(/helper/)
|
10
|
-
spec_caller = example_group.location.match(/spec.*b/).to_s
|
11
|
-
failed_shared_spec = example.location.match(/spec.*\d/).to_s
|
12
|
-
if spec_caller == @failed_shared_examples.keys.last || spec_caller == @failed_shared_examples.keys.first
|
13
|
-
key = @failed_shared_examples.keys.first
|
14
|
-
@failed_shared_examples[key] << "#{failed_shared_spec} "
|
15
|
-
else
|
16
|
-
@failed_shared_examples["#{spec_caller}"] = ["#{failed_shared_spec} "]
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end #if example.location is nil block ends
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
# RSpec 1: dumps 1 failed spec
|
24
|
-
def dump_failure(*args)
|
25
|
-
end
|
26
|
-
|
27
|
-
# RSpec 2: dumps all failed specs
|
28
|
-
def dump_failures(*args)
|
29
|
-
end
|
30
|
-
|
31
|
-
def dump_summary(*args)
|
32
|
-
lock_output do
|
33
|
-
if RSPEC_1
|
34
|
-
(@failed_shared_examples||{}).each_pair do |caller, example|
|
35
|
-
@output.puts "#{caller}:\n\n #{example}\n\n "
|
36
|
-
end
|
37
|
-
end
|
38
|
-
@output.flush
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|