parallelized_specs 0.3.59 → 0.3.60

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.59"
15
+ gem.version = "0.3.60"
16
16
  end
17
17
  Jeweler::GemcutterTasks.new
18
18
  rescue LoadError
@@ -110,32 +110,23 @@ class ParallelizedSpecs
110
110
  #parse and print results
111
111
  results = find_results(test_results.map { |result| result[:stdout] }*"")
112
112
  puts ""
113
- summary = summarize_results(results)
114
- puts "#{summary}"
113
+ puts summarize_results(results)
115
114
 
116
- total_ran_examples = summary.match(/\d*/).to_s
117
- total_expected_examples = 0
118
-
119
- File.open('tmp/parallel_log/total_specs.txt').each do |line|
120
- total_expected_examples += line.to_i
121
- end
122
115
  #report total time taken
123
116
  puts ""
124
117
  puts "Took #{Time.now - start} seconds"
125
118
 
119
+ Dir.glob('tmp/parallel_log/spec_count/{*,.*}').empty? ? puts "All threads completed" : abort "One or more threads have failed"
120
+
126
121
  #exit with correct status code so rake parallel:test && echo 123 works
127
- failed = test_results.any? { |result| result[:exit_status] != 0 }
128
- puts "entire failed object #{test_results}.to_s"
129
- puts "this is the exit status of the threads #{failed}"
130
122
 
131
- if failed && FileTest.exist?("#{RAILS_ROOT}/tmp/parallel_log/rspec.failures") && total_ran_examples == total_expected_examples
132
- puts "this is inside rerun condition"
123
+ if !Dir.glob('tmp/parallel_log/failed_specs/{*,.*}').empty? && FileTest.exist?("#{RAILS_ROOT}/tmp/parallel_log/rspec.failures")
133
124
  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."
134
125
  ParallelizedSpecs.rerun()
135
126
  else
136
- abort "#{name.capitalize}s Failed" if failed
127
+ abort "#{name.capitalize}s Failed" if !Dir.glob('tmp/parallel_log/failed_specs/{*,.*}').empty?
137
128
  end
138
- puts "marking build as PASSED"
129
+ puts "marking build as PASSED"
139
130
  end
140
131
 
141
132
  # parallel:spec[:count, :pattern, :options]
@@ -4,13 +4,35 @@ 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.puts(@example_count) }
13
+ super
14
+ end
15
+
7
16
  def example_failed(example, counter, failure)
8
17
  lock_output do
9
18
  @output.puts retry_command(example)
10
19
  end
11
20
  end
12
21
 
13
- def dump_summary(*args)
22
+ def dump_summary(duration, example_count, failure_count, pending_count)
23
+ env_test_number = ENV['TEST_ENV_NUMBER']
24
+ env_test_number = 1 if ENV['TEST_ENV_NUMBER'].blank?
25
+
26
+ File.open("tmp/parallel_log/spec_count/total_specs#{env_test_number}.txt").each do |line|
27
+ puts "this is thread #{env_test_number} with #{line} expected examples and #{example} actual examples"
28
+ if line == example_count
29
+ all_specs_ran = true
30
+ end
31
+ end
32
+
33
+ all_specs_ran == true ? File.delete("tmp/parallel_log/spec_count/total_specs#{env_test_number}.txt") : env_test_number
34
+
35
+ failure_count > 0 ? File.open("tmp/parallel_log/failed_specs/failed_specs#{env_test_number}.txt", 'a+') { |f| f.puts(failure_count) } : puts "All specs in Thread #{env_test_number} passed"
14
36
  end
15
37
 
16
38
  def dump_failures(*args)
@@ -9,16 +9,6 @@ class ParallelizedSpecs::SpecErrorLogger < ParallelizedSpecs::SpecLoggerBase
9
9
  @failed_examples = []
10
10
  end
11
11
 
12
- def start(example_count)
13
- @example_count = example_count
14
- env_test_number = ENV['TEST_ENV_NUMBER']
15
- env_test_number = 1 if ENV['TEST_ENV_NUMBER'].blank?
16
- puts "Thread #{env_test_number.to_s} has #{@example_count} specs"
17
- File.open("tmp/parallel_log/total_specs.txt", 'a+') {|f| f.puts(@example_count)}
18
- super
19
- end
20
-
21
-
22
12
  def example_passed(example)
23
13
  @passed_examples << example
24
14
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "parallelized_specs"
8
- s.version = "0.3.59"
8
+ s.version = "0.3.60"
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"]
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: 101
4
+ hash: 107
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 59
10
- version: 0.3.59
9
+ - 60
10
+ version: 0.3.60
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jake Sorce, Bryan Madsen, Shawn Meredith