summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-12-18 21:19:57 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-12-19 17:41:59 +0800
commit873bc3a6854689549cf426f726499619205a2798 (patch)
tree5498f7dc318a5fd01e336453067dfbfcd649a724 /scripts
parent888ed3096946f3b7b93d621285ae4c2c6aeef9d0 (diff)
downloadgitlab-ce-873bc3a6854689549cf426f726499619205a2798.tar.gz
Preserve gem path so that we use the same gemspreserve-gem-path
Without this patch, I would end up with: ``` An error occurred in a `before(:suite)` hook. Failure/Error: raise "could not connect to gitaly at #{socket.inspect} after #{sleep_time} seconds" RuntimeError: could not connect to gitaly at "tmp/tests/gitaly/gitaly.socket" after 10 seconds ``` Digging into it, it's because `scripts/gitaly-test-spawn` could not spawn the process, because it cannot find the installed gems. I personally installed all my gems under $HOME, namely with: * `gem install rake --user-install` or: * `bundle install --path ~/.gem` The gems would be installed to `~/.gem/ruby/2.4.0/gems`, where the version is Ruby ABI version. Now we're changing $HOME, making RubyGems think that the gems would be installed to `tmp/tests/ruby/2.4.0/gems` which is apparently not the case. In order to workaround this, we could preserve $GEM_PATH populated by RubyGems, ignoring the default path based on $HOME.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gitaly-test-spawn3
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/gitaly-test-spawn b/scripts/gitaly-test-spawn
index 8e05eca8d7e..ecb68c6acc6 100755
--- a/scripts/gitaly-test-spawn
+++ b/scripts/gitaly-test-spawn
@@ -1,7 +1,8 @@
#!/usr/bin/env ruby
gitaly_dir = 'tmp/tests/gitaly'
-env = { 'HOME' => File.expand_path('tmp/tests') }
+env = { 'HOME' => File.expand_path('tmp/tests'),
+ 'GEM_PATH' => Gem.path.join(':') }
args = %W[#{gitaly_dir}/gitaly #{gitaly_dir}/config.toml]
# Print the PID of the spawned process