parallelized_specs 0.4.35 → 0.4.36

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.4.35"
15
+ gem.version = "0.4.36"
16
16
  end
17
17
  Jeweler::GemcutterTasks.new
18
18
  rescue LoadError
@@ -0,0 +1,34 @@
1
+ require 'parallelized_specs'
2
+
3
+ module RSpec
4
+
5
+
6
+ class ParallelizedSpecs::SlowestSpecLogger < ParallelizedSpecs::SpecLoggerBase
7
+
8
+ def example_started(example)
9
+ @spec_start_time = Time.now
10
+ end
11
+
12
+ def example_passed(example)
13
+ total_time = determine_spec_duration(@spec_start_time)
14
+ write_total_spec_time(total_time, example)
15
+ end
16
+
17
+ def example_failed(example, count, failure)
18
+ total_time = determine_spec_duration(@spec_start_time)
19
+ write_total_spec_time(total_time, example)
20
+ end
21
+
22
+ def determine_spec_duration(spec_start_time)
23
+ total_time = Time.now - spec_start_time
24
+ total_time
25
+ end
26
+
27
+ def write_total_spec_time(total_time, example)
28
+ lock_output do
29
+ @output.puts "#{total_time}*#{example.description}"
30
+ end
31
+ @output.flush
32
+ end
33
+ end
34
+ end
@@ -9,6 +9,7 @@ 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'
12
+ require 'parallelized_specs/slow_spec_logger'
12
13
 
13
14
 
14
15
  class ParallelizedSpecs
@@ -304,8 +305,7 @@ class ParallelizedSpecs
304
305
  #can't just use exit code, if specs fail to start it will pass or if a spec isn't found, and sometimes rspec 1 exit codes aren't right
305
306
  rerun_status = result.scan(/\d*[^\D]\d*/).to_a
306
307
  puts "INFO: this is the rerun_status\n#{rerun_status}"
307
- example_index = rerun_status.length - 2
308
- @examples = rerun_status[example_index].to_i
308
+ @examples = rerun_status[-2].to_i
309
309
  @failures = rerun_status.last.to_i
310
310
  end
311
311
 
@@ -348,7 +348,7 @@ class ParallelizedSpecs
348
348
  abort "SEVERE: #{@error_count} errors, but the build failed, errors were not written to the file or there is something else wrong, marking build as a failure"
349
349
  when code == 6
350
350
  print_failures("#{RAILS_ROOT}/tmp/parallel_log/error.log")
351
- abort "SEVERE: #{@error_count} errors are to many to rerun, marking the build as a failure"
351
+ abort "SEVERE: #{@error_count} errors are to many to rerun, marking the build as a failure. Max errors defined for this build is #{@max_reruns}"
352
352
  when code == 7
353
353
  puts "#Total errors #{@error_count}"
354
354
  abort "SEVERE: unexpected error information, please check errors are being written to file correctly"
@@ -383,15 +383,16 @@ class ParallelizedSpecs
383
383
  @error_count = %x{wc -l "#{@filename}"}.match(/\d*[^\D]/).to_s #counts the number of lines in the file
384
384
  @error_count = @error_count.to_i
385
385
  puts "INFO: error count = #@error_count"
386
+ ENV["RERUNS"] != nil ? @max_reruns = ENV["RERUNS"].to_i : @max_reruns = 9
386
387
 
387
- if !@error_count.between?(1, 9)
388
+ if !@error_count.between?(1, @max_reruns)
388
389
  puts "INFO: total errors are not in rerun eligibility range"
389
390
  case
390
391
  when @error_count == 0
391
392
  puts "INFO: 0 errors build being aborted"
392
393
  abort_reruns(5)
393
- when @error_count > 9
394
- puts "INFO: error count has exceeded maximum errors of 9"
394
+ when @error_count > @max_reruns
395
+ puts "INFO: error count has exceeded maximum errors of #{@max_reruns}"
395
396
  abort_reruns(6)
396
397
  else
397
398
  abort_reruns(7)
@@ -450,7 +451,6 @@ class ParallelizedSpecs
450
451
 
451
452
 
452
453
  def self.determine_rerun_outcome
453
-
454
454
  if @rerun_failures.count > 0
455
455
  abort_reruns(8)
456
456
  elsif @rerun_passes.count >= @error_count
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "parallelized_specs"
8
- s.version = "0.4.35"
8
+ s.version = "0.4.36"
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"]
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  "lib/parallelized_specs/outcome_builder.rb",
25
25
  "lib/parallelized_specs/railtie.rb",
26
26
  "lib/parallelized_specs/runtime_logger.rb",
27
+ "lib/parallelized_specs/slow_spec_logger.rb",
27
28
  "lib/parallelized_specs/spec_error_count_logger.rb",
28
29
  "lib/parallelized_specs/spec_error_logger.rb",
29
30
  "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: 73
4
+ hash: 71
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 35
10
- version: 0.4.35
9
+ - 36
10
+ version: 0.4.36
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jake Sorce, Bryan Madsen, Shawn Meredith
@@ -52,6 +52,7 @@ files:
52
52
  - lib/parallelized_specs/outcome_builder.rb
53
53
  - lib/parallelized_specs/railtie.rb
54
54
  - lib/parallelized_specs/runtime_logger.rb
55
+ - lib/parallelized_specs/slow_spec_logger.rb
55
56
  - lib/parallelized_specs/spec_error_count_logger.rb
56
57
  - lib/parallelized_specs/spec_error_logger.rb
57
58
  - lib/parallelized_specs/spec_failures_logger.rb