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 <git@zjvandeweg.nl>2018-09-27 17:14:01 +0300
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2018-10-04 16:57:22 +0300
commitd28887ff2b1679604b358a16b05f16a67eb8ce7a (patch)
tree9142fb59b02fbdf3fdc02f9bb5465e1c9c127d4f
parentfa3e2a029b7f758a099e64c407c08588c41c3196 (diff)
Use a clean env to spawn gitaly-ruby during tests
Locally my tests failed, as the enviroment for the spawned Gitaly-Ruby didnt match the environment required. This showed as bundler wasnt available in that enviroment.
-rw-r--r--ruby/spec/integration_helper.rb21
1 files changed, 17 insertions, 4 deletions
diff --git a/ruby/spec/integration_helper.rb b/ruby/spec/integration_helper.rb
index 57e22b9b6..37f4c266c 100644
--- a/ruby/spec/integration_helper.rb
+++ b/ruby/spec/integration_helper.rb
@@ -4,6 +4,7 @@ require 'gitaly'
require 'spec_helper'
SOCKET_PATH = 'gitaly.socket'.freeze
+RUBY_PATH = File.expand_path('../', __FILE__)
TMP_DIR = File.expand_path('../../tmp', __FILE__)
module IntegrationClient
@@ -17,6 +18,16 @@ module IntegrationClient
end
end
+def env
+ env_hash = {
+ 'BUNDLE_FLAGS' => "--jobs=4 --retry=3",
+ 'BUNDLE_INSTALL_FLAGS' => nil,
+ 'RUBYOPT' => nil
+ }
+ env_hash['BUNDLE_APP_CONFIG'] = File.join(RUBY_PATH, '.bundle/config') unless ENV['CI']
+ env_hash
+end
+
def start_gitaly
build_dir = File.expand_path('../../../_build', __FILE__)
gitlab_shell_dir = File.join(TMP_DIR, 'gitlab-shell')
@@ -26,13 +37,13 @@ def start_gitaly
config_toml = <<~CONFIG
socket_path = "#{SOCKET_PATH}"
bin_dir = "#{build_dir}/bin"
-
+
[gitlab-shell]
dir = "#{gitlab_shell_dir}"
-
+
[gitaly-ruby]
dir = "#{build_dir}/assembly/ruby"
-
+
[[storage]]
name = "#{DEFAULT_STORAGE_NAME}"
path = "#{DEFAULT_STORAGE_DIR}"
@@ -42,7 +53,9 @@ def start_gitaly
test_log = File.join(TMP_DIR, 'gitaly-rspec-test.log')
options = { out: test_log, err: test_log, chdir: TMP_DIR }
- gitaly_pid = spawn(File.join(build_dir, 'bin/gitaly'), config_path, options)
+
+ gitaly_pid = spawn(env, File.join(build_dir, 'bin/gitaly'), config_path, options)
+
at_exit { Process.kill('KILL', gitaly_pid) }
wait_ready!(File.join('tmp', SOCKET_PATH))
end