From 9dc93a4519d9d5d7be48ff274127136236a3adb3 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 20 Apr 2021 23:50:22 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-11-stable-ee --- scripts/gitaly_test.rb | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'scripts/gitaly_test.rb') diff --git a/scripts/gitaly_test.rb b/scripts/gitaly_test.rb index 2262870eb96..b7ea9cd628e 100644 --- a/scripts/gitaly_test.rb +++ b/scripts/gitaly_test.rb @@ -12,11 +12,11 @@ require 'logger' module GitalyTest LOGGER = begin - default_name = ENV['CI'] ? 'DEBUG' : 'WARN' - level_name = ENV['GITLAB_TESTING_LOG_LEVEL']&.upcase - level = Logger.const_get(level_name || default_name, true) # rubocop: disable Gitlab/ConstGetInheritFalse - Logger.new(STDOUT, level: level, formatter: ->(_, _, _, msg) { msg }) - end + default_name = ENV['CI'] ? 'DEBUG' : 'WARN' + level_name = ENV['GITLAB_TESTING_LOG_LEVEL']&.upcase + level = Logger.const_get(level_name || default_name, true) # rubocop: disable Gitlab/ConstGetInheritFalse + Logger.new(STDOUT, level: level, formatter: ->(_, _, _, msg) { msg }) + end def tmp_tests_gitaly_dir File.expand_path('../tmp/tests/gitaly', __dir__) @@ -34,16 +34,19 @@ module GitalyTest File.join(tmp_tests_gitaly_dir, 'ruby', 'Gemfile') end + def gemfile_dir + File.dirname(gemfile) + end + def gitlab_shell_secret_file File.join(tmp_tests_gitlab_shell_dir, '.gitlab_shell_secret') end def env - env_hash = { + { 'HOME' => File.expand_path('tmp/tests'), 'GEM_PATH' => Gem.path.join(':'), - 'BUNDLE_APP_CONFIG' => File.join(File.dirname(gemfile), '.bundle/config'), - 'BUNDLE_FLAGS' => "--jobs=4 --retry=3", + 'BUNDLE_APP_CONFIG' => File.join(gemfile_dir, '.bundle'), 'BUNDLE_INSTALL_FLAGS' => nil, 'BUNDLE_GEMFILE' => gemfile, 'RUBYOPT' => nil, @@ -51,14 +54,19 @@ module GitalyTest # Git hooks can't run during tests as the internal API is not running. 'GITALY_TESTING_NO_GIT_HOOKS' => "1" } + end + + # rubocop:disable GitlabSecurity/SystemCommandInjection + def set_bundler_config + system('bundle config set --local jobs 4', chdir: gemfile_dir) + system('bundle config set --local retry 3', chdir: gemfile_dir) if ENV['CI'] bundle_path = File.expand_path('../vendor/gitaly-ruby', __dir__) - env_hash['BUNDLE_FLAGS'] += " --path=#{bundle_path}" + system('bundle', 'config', 'set', '--local', 'path', bundle_path, chdir: gemfile_dir) end - - env_hash end + # rubocop:enable GitlabSecurity/SystemCommandInjection def config_path(service) case service -- cgit v1.2.3