Skip to content
Browse files

retry failing integration tests

  • Loading branch information...
1 parent b5bbb27 commit b882ab37df7d0a850d6e2091507dbc66d1ae2ea0 @rkh rkh committed Mar 18, 2012
Showing with 12 additions and 10 deletions.
  1. +12 −10 test/integration_helper.rb
View
22 test/integration_helper.rb
@@ -129,6 +129,17 @@ def thin?
def warnings
log.scan(%r[(?:\(eval|lib/sinatra).*warning:.*$])
end
+
+ def run_test(target, &block)
+ retries ||= 3
+ target.server = self
+ run unless alive?
+ target.instance_eval(&block)
+ rescue Exception => error
+ retries -= 1
+ kill
+ retries < 0 ? retry : raise(error)
+ end
end
if RUBY_ENGINE == "jruby"
@@ -188,16 +199,7 @@ def kill
def it(message, &block)
Server.each do |server|
next unless server.installed?
- super "with #{server.name}: #{message}" do
- self.server = server
- server.run unless server.alive?
- begin
- instance_eval(&block)
- rescue Exception => error
- server.kill
- raise error
- end
- end
+ super("with #{server.name}: #{message}") { server.run_test(self, &block) }
end
end

0 comments on commit b882ab3

Please sign in to comment.
Something went wrong with that request. Please try again.