Commit bb0ec1ce authored by Imre Farkas's avatar Imre Farkas

Merge branch 'jv-gitaly-rspec-hint' into 'master'

Add rspec gitaly troubleshooting hint

See merge request gitlab-org/gitlab!19616
parents 2a150e3e 26aa8011
......@@ -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
......
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