Permalink
Browse files

improve integration server handling

  • Loading branch information...
1 parent 895b09b commit a2c67e4e2737fa1983006e719fe4a94443b6ed1b @rkh rkh committed Mar 8, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 test/integration_helper.rb
View
10 test/integration_helper.rb
@@ -36,6 +36,7 @@ def initialize(server, port)
def run
return unless installed?
+ kill
@log = ""
@pipe = IO.popen(command)
@started = Time.now
@@ -64,7 +65,7 @@ def ping(timeout = 10)
def alive?
3.times { get('/ping') }
true
- rescue Errno::ECONNREFUSED, Errno::ECONNRESET => error
+ rescue Errno::ECONNREFUSED, Errno::ECONNRESET, EOFError => error
false
end
@@ -127,7 +128,12 @@ def it(message, &block)
super "with #{server.name}: #{message}" do
self.server = server
server.run unless server.alive?
- instance_eval(&block)
+ begin
+ instance_eval(&block)
+ rescue Exception => error
+ server.kill
+ raise error
+ end
end
end
end

0 comments on commit a2c67e4

Please sign in to comment.