diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-06 18:06:23 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-06 18:06:23 +0300 |
commit | 5277f8e69e935eabd3bf8c5e7833471b5bfad1d9 (patch) | |
tree | 405b231961d09fa399e7c4311235ee67a5da6727 /spec/support/helpers/test_env.rb | |
parent | 4dcee85bb2384604153165f1296fb86d609c71cc (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/helpers/test_env.rb')
-rw-r--r-- | spec/support/helpers/test_env.rb | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/spec/support/helpers/test_env.rb b/spec/support/helpers/test_env.rb index 538380a625c..6a23875f103 100644 --- a/spec/support/helpers/test_env.rb +++ b/spec/support/helpers/test_env.rb @@ -148,8 +148,6 @@ module TestEnv end def setup_gitaly - socket_path = Gitlab::GitalyClient.address('default').sub(/\Aunix:/, '') - gitaly_dir = File.dirname(socket_path) install_gitaly_args = [gitaly_dir, repos_path, gitaly_url].compact.join(',') component_timed_setup('Gitaly', @@ -162,8 +160,16 @@ module TestEnv end end + def gitaly_socket_path + Gitlab::GitalyClient.address('default').sub(/\Aunix:/, '') + end + + def gitaly_dir + File.dirname(gitaly_socket_path) + end + def start_gitaly(gitaly_dir) - if ENV['CI'].present? + if ci? # Gitaly has been spawned outside this process already return end @@ -172,8 +178,13 @@ module TestEnv spawn_script = Rails.root.join('scripts/gitaly-test-spawn').to_s Bundler.with_original_env do - raise "gitaly spawn failed" unless system(spawn_script) + unless system(spawn_script) + message = 'gitaly spawn failed' + message += " (try `rm -rf #{gitaly_dir}` ?)" unless ci? + raise message + end end + @gitaly_pid = Integer(File.read('tmp/tests/gitaly.pid')) Kernel.at_exit { stop_gitaly } @@ -386,7 +397,7 @@ module TestEnv ensure_component_dir_name_is_correct!(component, install_dir) # On CI, once installed, components never need update - return if File.exist?(install_dir) && ENV['CI'] + return if File.exist?(install_dir) && ci? if component_needs_update?(install_dir, version) # Cleanup the component entirely to ensure we start fresh @@ -407,6 +418,10 @@ module TestEnv puts " #{component} set up in #{Time.now - start} seconds...\n" end + def ci? + ENV['CI'].present? + end + def ensure_component_dir_name_is_correct!(component, path) actual_component_dir_name = File.basename(path) expected_component_dir_name = component.parameterize |