Commit 456843de authored by Toon Claes's avatar Toon Claes

test: Use GDK's Gitaly vendored gems if exist

Some users prefer to vendor the installed gems. This also applies to the
gems installed in <gdk>/gitaly/ruby.

Since [1] the setup of Gitaly is sped up by copying files over from
GDK's Gitaly. But this change also skipped over installation of gems. So
when GDK's Gitaly is using vendored gems, Gitaly in test will not find
them.

This change goes looking into GDK's Gitaly to see if it vendored gems,
and if so the BUNDLE_PATH is set to that directory.

1. 08af0f9f (Speed up gitaly setup in tests, 2021-07-20)
parent e94f41c9
......@@ -47,6 +47,17 @@ module GitalySetup
File.join(tmp_tests_gitlab_shell_dir, '.gitlab_shell_secret')
end
# Return the path of the vendored gems in <gdk>/gitaly, if exists
def gdk_gitaly_ruby_gem_path
gitaly_ruby_path = File.expand_path('../../../../gitaly/ruby/', __dir__)
bundle_config_path = File.join(gitaly_ruby_path, '.bundle')
bundle_path = Bundler::Settings.new(bundle_config_path).path
return if bundle_path.use_system_gems?
File.expand_path(bundle_path.explicit_path, gitaly_ruby_path)
end
def env
{
'HOME' => File.expand_path('tmp/tests'),
......@@ -68,7 +79,7 @@ module GitalySetup
if ENV['CI']
File.expand_path('../../../vendor/gitaly-ruby', __dir__)
else
File.expand_path(Bundler.configured_bundle_path.base_path)
gdk_gitaly_ruby_gem_path || File.expand_path(Bundler.configured_bundle_path.base_path)
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment