parallelized_specs 0.3.30 → 0.3.31
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/parallelized_specs.rb +45 -33
- data/lib/parallelized_specs/failures_rerun_logger.rb +0 -6
- data/parallelized_specs.gemspec +2 -2
- metadata +4 -4
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.31"
|
16
16
|
end
|
17
17
|
Jeweler::GemcutterTasks.new
|
18
18
|
rescue LoadError
|
data/lib/parallelized_specs.rb
CHANGED
@@ -269,49 +269,61 @@ class ParallelizedSpecs
|
|
269
269
|
|
270
270
|
def self.rerun()
|
271
271
|
rerun_failed_examples = false
|
272
|
-
|
272
|
+
rerun_specs = []
|
273
|
+
filename = "#{RAILS_ROOT}/tmp/parallel_log/rspec.failures"
|
273
274
|
|
274
|
-
|
275
|
-
|
275
|
+
@error_count = %x{wc -l "#{filename}"}.match(/\d/).to_s #counts the number of lines in the file
|
276
|
+
if @error_count.to_i > 1 && @error_count.to_i < 10
|
276
277
|
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
puts "#{l} will be ran and marked as a success if it passes"
|
285
|
-
result = %x[bundle exec rake spec #{l}]
|
286
|
-
rerun_status = result.match(/FAILED/).to_s
|
278
|
+
File.open(filename).each_line do |line|
|
279
|
+
if line =~ /spec\/selenium\/helpers/ || line =~ /spec\/selenium\/shared/
|
280
|
+
abort "shared specs currently are not eligiable for reruns, marking build as a failure"
|
281
|
+
else
|
282
|
+
rerun_specs.push line
|
283
|
+
end
|
284
|
+
end
|
287
285
|
|
288
|
-
|
286
|
+
puts "rerunning #{@error_count} examples again"
|
287
|
+
@rerun_failures ||= []
|
288
|
+
@rerun_passes ||= []
|
289
|
+
|
290
|
+
rerun_specs.each do |l|
|
291
|
+
rerun_failed_examples = true
|
292
|
+
puts "#{l} will be ran and marked as a success if it passes"
|
293
|
+
result = %x[bundle exec rake spec #{l}]
|
294
|
+
#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
|
295
|
+
rerun_status = result.match(/1 example, \d failure/).to_s
|
296
|
+
|
297
|
+
case rerun_status
|
298
|
+
when ""
|
299
|
+
abort "the spec failed to run on the rerun try, marking build as failed"
|
300
|
+
when "1 example, 1 failure"
|
289
301
|
puts "the example failed again"
|
290
302
|
@rerun_failures << l
|
291
|
-
|
292
|
-
else
|
303
|
+
when "1 example, 0 failure"
|
293
304
|
puts "the example passed and is being marked as a success"
|
294
305
|
@rerun_passes << l
|
295
|
-
|
296
|
-
|
297
|
-
end
|
298
|
-
|
299
|
-
|
306
|
+
else
|
307
|
+
abort "unexpected outcome on the rerun, marking build as a failure"
|
308
|
+
end
|
309
|
+
rerun_status = ""
|
310
|
+
end #end file loop
|
311
|
+
else
|
312
|
+
if @error_count == 0
|
313
|
+
abort "#{@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"
|
314
|
+
elsif @error_count > 10
|
315
|
+
abort "#{error_count} errors are to many to rerun, marking the build as a failure"
|
300
316
|
end
|
317
|
+
end
|
301
318
|
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
puts "something unexpected happened not safe to mark the build as passed."
|
310
|
-
abort "unexpected situation on rerun, marking build as failure"
|
311
|
-
end
|
319
|
+
if rerun_failed_examples
|
320
|
+
if @rerun_failures.count > 0
|
321
|
+
abort "some specs failed on rerun, the build will be marked as failed"
|
322
|
+
elsif @rerun_passes.count >= @error_count.to_i
|
323
|
+
puts "all rerun examples passed, rspec will mark this build as passed"
|
324
|
+
else
|
325
|
+
abort "unexpected situation on rerun, marking build as failure"
|
312
326
|
end
|
313
|
-
else
|
314
|
-
"No errors file was found, marking build as a success"
|
315
327
|
end
|
316
328
|
end
|
317
329
|
end
|
@@ -6,8 +6,6 @@ module RSpec
|
|
6
6
|
FILENAME = "#{RAILS_ROOT}/tmp/parallel_log/rspec.failures"
|
7
7
|
|
8
8
|
def example_failed(example, counter, failure)
|
9
|
-
@rerun_examples ||= []
|
10
|
-
@rerun_examples << failure
|
11
9
|
f = File.new(FILENAME, "a+")
|
12
10
|
f.puts retry_command(example)
|
13
11
|
end
|
@@ -32,9 +30,5 @@ module RSpec
|
|
32
30
|
spec_name = example.description
|
33
31
|
"SPEC=#{Dir.pwd}/#{spec_file} SPEC_OPTS='-e \"#{spec_name}\"'"
|
34
32
|
end
|
35
|
-
|
36
|
-
def close()
|
37
|
-
@output.close if (IO === @output) & (@output != $stdout)
|
38
|
-
end
|
39
33
|
end
|
40
34
|
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.31"
|
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-11-
|
12
|
+
s.date = "2012-11-05"
|
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:
|
4
|
+
hash: 45
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 31
|
10
|
+
version: 0.3.31
|
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-11-
|
18
|
+
date: 2012-11-05 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: parallel
|