Wait for gitaly to boot during tests
This commit is contained in:
parent
d1b60cbc67
commit
1dce0a270e
1 changed files with 18 additions and 0 deletions
|
@ -176,6 +176,24 @@ module TestEnv
|
|||
|
||||
spawn_script = Rails.root.join('scripts/gitaly-test-spawn').to_s
|
||||
@gitaly_pid = Bundler.with_original_env { IO.popen([spawn_script], &:read).to_i }
|
||||
wait_gitaly
|
||||
end
|
||||
|
||||
def wait_gitaly
|
||||
sleep_time = 10
|
||||
sleep_interval = 0.1
|
||||
socket = Gitlab::GitalyClient.address('default').sub('unix:', '')
|
||||
|
||||
Integer(sleep_time / sleep_interval).times do
|
||||
begin
|
||||
Socket.unix(socket)
|
||||
return
|
||||
rescue
|
||||
sleep sleep_interval
|
||||
end
|
||||
end
|
||||
|
||||
raise "could not connect to gitaly at #{socket.inspect} after #{sleep_time} seconds"
|
||||
end
|
||||
|
||||
def stop_gitaly
|
||||
|
|
Loading…
Reference in a new issue