Commit 5acd2df4 authored by georg's avatar georg

specs: Wait for SKS mock keyserver to really be up

This commit fixes sometimes ocurring problems, in which we've queried
the SKS mock keyserver too early, before it was really up, leading to
failed specs.

Closes: #262
parent 2835314c
......@@ -16,6 +16,7 @@ require 'schleuder'
require 'schleuder/cli'
require 'database_cleaner'
require 'factory_girl'
require 'net/http'
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
......@@ -71,8 +72,22 @@ RSpec.configure do |config|
def with_sks_mock
pid = Process.spawn('spec/sks-mock.rb', [:out, :err] => ["/tmp/sks-mock.log", 'w'])
sleep 1
uri = URI.parse("http://127.0.0.1:9999/status")
attempts = 5
begin
sleep 1
Net::HTTP.get(uri)
rescue Errno::ECONNREFUSED => exc
attempts -= 1
if attempts > 0
retry
else
raise "sks-mock.rb failed to start, cannot continue: #{exc}"
end
end
yield
Process.kill 'TERM', pid
Process.wait pid
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment