Commit 26aa8011 authored by Jacob Vosmaer's avatar Jacob Vosmaer Committed by Imre Farkas

Add rspec gitaly troubleshooting hint

parent 2a150e3e
...@@ -148,8 +148,6 @@ module TestEnv ...@@ -148,8 +148,6 @@ module TestEnv
end end
def setup_gitaly 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(',') install_gitaly_args = [gitaly_dir, repos_path, gitaly_url].compact.join(',')
component_timed_setup('Gitaly', component_timed_setup('Gitaly',
...@@ -162,8 +160,16 @@ module TestEnv ...@@ -162,8 +160,16 @@ module TestEnv
end end
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) def start_gitaly(gitaly_dir)
if ENV['CI'].present? if ci?
# Gitaly has been spawned outside this process already # Gitaly has been spawned outside this process already
return return
end end
...@@ -172,8 +178,13 @@ module TestEnv ...@@ -172,8 +178,13 @@ module TestEnv
spawn_script = Rails.root.join('scripts/gitaly-test-spawn').to_s spawn_script = Rails.root.join('scripts/gitaly-test-spawn').to_s
Bundler.with_original_env do 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
end
@gitaly_pid = Integer(File.read('tmp/tests/gitaly.pid')) @gitaly_pid = Integer(File.read('tmp/tests/gitaly.pid'))
Kernel.at_exit { stop_gitaly } Kernel.at_exit { stop_gitaly }
...@@ -386,7 +397,7 @@ module TestEnv ...@@ -386,7 +397,7 @@ module TestEnv
ensure_component_dir_name_is_correct!(component, install_dir) ensure_component_dir_name_is_correct!(component, install_dir)
# On CI, once installed, components never need update # 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) if component_needs_update?(install_dir, version)
# Cleanup the component entirely to ensure we start fresh # Cleanup the component entirely to ensure we start fresh
...@@ -407,6 +418,10 @@ module TestEnv ...@@ -407,6 +418,10 @@ module TestEnv
puts " #{component} set up in #{Time.now - start} seconds...\n" puts " #{component} set up in #{Time.now - start} seconds...\n"
end end
def ci?
ENV['CI'].present?
end
def ensure_component_dir_name_is_correct!(component, path) def ensure_component_dir_name_is_correct!(component, path)
actual_component_dir_name = File.basename(path) actual_component_dir_name = File.basename(path)
expected_component_dir_name = component.parameterize 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