Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <zegerjan@gitlab.com>2018-09-28 17:41:22 +0300
committerZeger-Jan van de Weg <zegerjan@gitlab.com>2018-09-28 17:41:22 +0300
commit2083b01f74796330a76ec891b91e99c6f68da7f3 (patch)
tree37d784ee94c8b8064118a1b20f4240cbcdfa1796
parentc5f74f2f46e83b648356c7784ed6cbbd8d1702e4 (diff)
parentd4b3a81c74267ad7e37cadb5701471b414114ae5 (diff)
Merge branch 'rspec-wait-gitaly-boot' into 'master'
Wait for gitaly to boot in rspec integration tests See merge request gitlab-org/gitaly!890
-rw-r--r--changelogs/unreleased/rspec-wait-gitaly-boot.yml5
-rw-r--r--ruby/spec/integration_helper.rb25
2 files changed, 29 insertions, 1 deletions
diff --git a/changelogs/unreleased/rspec-wait-gitaly-boot.yml b/changelogs/unreleased/rspec-wait-gitaly-boot.yml
new file mode 100644
index 000000000..a96673d38
--- /dev/null
+++ b/changelogs/unreleased/rspec-wait-gitaly-boot.yml
@@ -0,0 +1,5 @@
+---
+title: Wait for gitaly to boot in rspec integration tests
+merge_request: 890
+author:
+type: other
diff --git a/ruby/spec/integration_helper.rb b/ruby/spec/integration_helper.rb
index 0186d0514..57e22b9b6 100644
--- a/ruby/spec/integration_helper.rb
+++ b/ruby/spec/integration_helper.rb
@@ -1,5 +1,7 @@
+require 'socket'
+
require 'gitaly'
-require 'test_repo_helper'
+require 'spec_helper'
SOCKET_PATH = 'gitaly.socket'.freeze
TMP_DIR = File.expand_path('../../tmp', __FILE__)
@@ -42,6 +44,27 @@ def start_gitaly
options = { out: test_log, err: test_log, chdir: TMP_DIR }
gitaly_pid = spawn(File.join(build_dir, 'bin/gitaly'), config_path, options)
at_exit { Process.kill('KILL', gitaly_pid) }
+ wait_ready!(File.join('tmp', SOCKET_PATH))
+end
+
+def wait_ready!(socket)
+ last_exception = StandardError.new('wait_ready! has not made any connection attempts')
+
+ print('Booting gitaly for integration tests')
+ 100.times do |i|
+ sleep 0.1
+ printf('.')
+ begin
+ UNIXSocket.new(socket).close
+ puts ' ok'
+ return
+ rescue => ex
+ last_exception = ex
+ end
+ end
+
+ puts
+ raise last_exception
end
start_gitaly