parallelized_specs 0.4.09 → 0.4.10

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.09"
15
+ gem.version = "0.4.10"
16
16
  end
17
17
  Jeweler::GemcutterTasks.new
18
18
  rescue LoadError
@@ -309,6 +309,9 @@ class ParallelizedSpecs
309
309
 
310
310
  def self.rerun_spec(spec)
311
311
  puts "INFO: #{spec} will be ran and marked as a success if it passes"
312
+ result = ""
313
+ @examples = ""
314
+ @failures = ""
312
315
  result = %x[DISPLAY=:99 bundle exec rake spec #{spec}]
313
316
  parse_result(result)
314
317
  result
@@ -375,63 +378,71 @@ class ParallelizedSpecs
375
378
  def self.calculate_error_count()
376
379
  @error_count = %x{wc -l "#{@filename}"}.match(/\d*[^\D]/).to_s #counts the number of lines in the file
377
380
  @error_count = @error_count.to_i
381
+ if !@error_count.between?(1, 9)
382
+ case
383
+ when @error_count == 0
384
+ puts "0 errors build being aborted"
385
+ abort_reruns(5)
386
+ when @error_count > 9
387
+ puts "error count has exceeded maximum errors of 9"
388
+ abort_reruns(6)
389
+ else
390
+ abort_reruns(7)
391
+ end
392
+ else
393
+ puts "INFO: "
394
+ end
378
395
  end
379
396
 
380
397
  def self.determine_rerun_eligibility
398
+ @error_count = calculate_error_count
399
+ puts "INFO: total errors #{@error_count}"
400
+
381
401
  File.open(@filename).each_line do |line|
382
- if line =~ /spec\/selenium\/helpers/ || line =~ /spec\/selenium\/shared_examples/
402
+ if line =~ /spec\/selenium\/helpers/
383
403
  abort_reruns(1)
384
404
  else
405
+ "INFO: the following spec is eligible for reruns #{line}"
385
406
  @rerun_specs.push line
386
407
  end
387
408
  end
388
409
  puts "INFO: failures meet rerun criteria \n INFO: rerunning #{@error_count} examples"
389
410
  end
390
411
 
391
- def self.start_reruns(error_count)
392
- case
393
- when @error_count.between?(1, 9)
394
- determine_rerun_eligibility
395
-
396
- @rerun_failures ||= []
397
- @rerun_passes ||= []
412
+ def self.start_reruns()
413
+ determine_rerun_eligibility
398
414
 
399
- @rerun_specs.each do |l|
400
- result = rerun_spec(l)
415
+ @rerun_failures ||= []
416
+ @rerun_passes ||= []
401
417
 
402
- if @examples == 0 and @failures == 0
403
- abort_reruns(2, result)
404
- end
405
-
406
- if @examples == 0 #when specs fail to run it exits with 0 examples, 0 failures and won't be matched by the previous regex
407
- abort_reruns(3, result)
408
- elsif @failures > 0
409
- update_failed(l, result)
410
- elsif @examples > 0 && @failures == 0
411
- update_passed(l)
412
- else
413
- abort_reruns(4, result)
414
- end
415
- end #end file loop
418
+ @rerun_specs.each do |l|
419
+ result = rerun_spec(l)
416
420
 
417
- when @error_count == 0
418
- abort_reruns(5)
419
- when @error_count > 9
420
- abort_reruns(6)
421
+ if @examples == 0 #when specs fail to run it exits with 0 examples, 0 failures and won't be matched by the previous regex
422
+ abort_reruns(3, result)
423
+ elsif @failures > 0
424
+ update_failed(l, result)
425
+ elsif @examples > 0 && @failures == 0
426
+ update_passed(l)
421
427
  else
422
- abort_reruns(7)
428
+ abort_reruns(4, result)
429
+ end
423
430
  end
431
+ puts "INFO: reruns have completed calculating if build has passed or failed"
432
+ determine_rerun_outcome
433
+ #end file loop
424
434
  end
425
435
 
436
+
426
437
  def self.determine_rerun_outcome
427
- if @rerun_failures.count > 0
428
- abort_reruns(8)
429
- elsif @rerun_passes.count >= @error_count
430
- pass_reruns
431
- else
432
- abort_reruns(9)
433
- end
438
+ if @rerun_failures.count > 0
439
+ abort_reruns(8)
440
+ elsif @rerun_passes.count >= @error_count
441
+ pass_reruns
442
+ else
443
+ abort_reruns(9)
434
444
  end
445
+ end
435
446
 
436
447
 
437
448
  def self.runtime_setup
@@ -443,10 +454,7 @@ class ParallelizedSpecs
443
454
  def self.rerun()
444
455
  puts "INFO: beginning the failed specs rerun process"
445
456
  runtime_setup
446
- @error_count = calculate_error_count
447
- puts "INFO: total errors #{@error_count}"
448
- start_reruns(@error_count)
449
- determine_rerun_outcome
457
+ start_reruns()
450
458
  end
451
459
  end
452
460
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "parallelized_specs"
8
- s.version = "0.4.09"
8
+ s.version = "0.4.10"
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-02-05"
12
+ s.date = "2013-02-06"
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: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 9
10
- version: 0.4.09
9
+ - 10
10
+ version: 0.4.10
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-02-05 00:00:00 Z
18
+ date: 2013-02-06 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: parallel