parallelized_specs 0.3.91 → 0.3.92

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.91"
15
+ gem.version = "0.3.92"
16
16
  end
17
17
  Jeweler::GemcutterTasks.new
18
18
  rescue LoadError
@@ -293,11 +293,33 @@ class ParallelizedSpecs
293
293
  end
294
294
  end
295
295
 
296
+ def update_rerun_summary(result, file)
297
+ File.open(file, 'a+') { |f| f.puts(result) }
298
+ end
299
+
300
+ def parse_result(result)
301
+ puts "this is the result\n#{result}"
302
+ #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
303
+ rerun_status = result.scan(/\d*[^\D]\d*/).to_a
304
+ puts "this is the rerun_status\n#{rerun_status}"
305
+ example_index = rerun_status.length - 2
306
+ @examples = rerun_status[example_index].to_i
307
+ @failures = rerun_status.last.to_i
308
+ end
309
+
310
+ def rerun_spec(spec)
311
+ puts "#{spec} will be ran and marked as a success if it passes"
312
+ result = %x[DISPLAY=:99 bundle exec rake spec #{spec}]
313
+ parse_result(result)
314
+ result
315
+ end
316
+
296
317
  def self.rerun()
297
318
  puts "beginning the failed specs rerun process"
298
319
  rerun_failed_examples = false
299
320
  rerun_specs = []
300
321
  filename = "#{RAILS_ROOT}/tmp/parallel_log/rspec.failures"
322
+ failure_summary = "#{RAILS_ROOT}/tmp/parallel_log/rerun_failure_summary.log"
301
323
 
302
324
  @error_count = %x{wc -l "#{filename}"}.match(/\d*[^\D]/).to_s #counts the number of lines in the file
303
325
  @error_count = @error_count.to_i
@@ -310,36 +332,26 @@ class ParallelizedSpecs
310
332
  else
311
333
  rerun_specs.push line
312
334
  end
335
+ rerun_failed_examples = true
336
+ puts "failed specs will be rerun\n rerunning #{@error_count} examples"
337
+ @rerun_failures ||= []
338
+ @rerun_passes ||= []
313
339
  end
314
340
 
315
- puts "failed specs will be rerun\n rerunning #{@error_count} examples"
316
- @rerun_failures ||= []
317
- @rerun_passes ||= []
318
-
319
341
  rerun_specs.each do |l|
320
- rerun_failed_examples = true
321
- puts "#{l} will be ran and marked as a success if it passes"
322
-
323
- result = %x[DISPLAY=:99 bundle exec rake spec #{l}]
324
-
325
-
326
- puts "this is the result\n#{result}"
327
- #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
328
- rerun_status = result.scan(/\d*[^\D]\d*/).to_a
329
- puts "this is the rerun_status\n#{rerun_status}"
330
-
331
- example_index = rerun_status.length - 2
332
- @examples = rerun_status[example_index].to_i
333
- @failures = rerun_status.last.to_i
342
+ result = rerun_spec(l)
334
343
 
335
344
  if @examples == 0 and @failures == 0
345
+ update_rerun_summary(result, failure_summary)
336
346
  abort "spec didn't actually run, ending rerun process early"
337
347
  end
338
348
 
339
349
  if @examples == 0 #when specs fail to run it exits with 0 examples, 0 failures and won't be matched by the previous regex
350
+ update_rerun_summary(result, failure_summary)
340
351
  abort "the spec failed to run on the rerun try, marking build as failed"
341
352
  elsif @failures > 0
342
353
  puts "the example failed again"
354
+ update_rerun_summary(result, failure_summary)
343
355
  @rerun_failures << l
344
356
  elsif @examples > 0 && @failures == 0
345
357
  puts "the example passed and is being marked as a success"
@@ -347,7 +359,6 @@ class ParallelizedSpecs
347
359
  else
348
360
  abort "unexpected outcome on the rerun, marking build as a failure"
349
361
  end
350
- rerun_status = ""
351
362
  end #end file loop
352
363
 
353
364
  when @error_count == 0
@@ -361,6 +372,9 @@ class ParallelizedSpecs
361
372
 
362
373
  if rerun_failed_examples
363
374
  if @rerun_failures.count > 0
375
+ File.open(failure_summary).each_line do |line|
376
+ puts.line
377
+ end
364
378
  abort "some specs failed on rerun, the build will be marked as failed"
365
379
  elsif @rerun_passes.count >= @error_count
366
380
  puts "all rerun examples passed, rspec will mark this build as passed"
@@ -369,6 +383,5 @@ class ParallelizedSpecs
369
383
  end
370
384
  end
371
385
  end
372
-
373
386
  end
374
387
 
@@ -27,11 +27,11 @@ module RSpec
27
27
  end
28
28
 
29
29
 
30
- def retry_command(example)
30
+ def retry_command(example, failure)
31
31
  puts "Storing #{example_group.location} for a post build rerun attempt"
32
32
  spec_file = example_group.location.match(/.*rb/).to_s
33
33
  spec_name = example.description
34
- "SPEC=#{spec_file} SPEC_OPTS=\"-e \\\"#{spec_name}\\\"\""
34
+ "SPEC=#{spec_file} SPEC_OPTS=\"-e \\\"#{spec_name}\\\"\"* #{failure}"
35
35
  end
36
36
  end
37
37
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "parallelized_specs"
8
- s.version = "0.3.91"
8
+ s.version = "0.3.92"
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 = "2013-01-15"
12
+ s.date = "2013-01-26"
13
13
  s.email = "jake@instructure.com"
14
14
  s.files = [
15
15
  "Gemfile",
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: 165
4
+ hash: 171
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 91
10
- version: 0.3.91
9
+ - 92
10
+ version: 0.3.92
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: 2013-01-15 00:00:00 Z
18
+ date: 2013-01-26 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: parallel