diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 02:50:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 02:50:22 +0300 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /scripts/gitaly_test.rb | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'scripts/gitaly_test.rb')
-rw-r--r-- | scripts/gitaly_test.rb | 30 |
1 files changed, 19 insertions, 11 deletions
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 |