summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-09-06 12:15:01 +0000
committerRémy Coutable <remy@rymai.me>2017-09-06 12:15:01 +0000
commitba302454e1191f28453929df80e13c4dd418f8c7 (patch)
tree1723f16685efcf3dbd04123c44d4747d1eeffd2c
parent99852965211166c21807522603818e41d03aa2d3 (diff)
parent1dce0a270e70c40eecb6fe5ef53283e8cc763aea (diff)
downloadgitlab-ce-ba302454e1191f28453929df80e13c4dd418f8c7.tar.gz
Merge branch 'test-wait-gitaly-boot' into 'master'
Wait for gitaly to boot during tests See merge request !14051
-rw-r--r--spec/support/test_env.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb
index 290ded3ff7e..71b9deeabc3 100644
--- a/spec/support/test_env.rb
+++ b/spec/support/test_env.rb
@@ -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