diff options
author | Rémy Coutable <remy@rymai.me> | 2017-08-04 17:27:50 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-08-04 17:27:50 +0200 |
commit | 21937a157d435025d4ae0cf514fe7273302e1004 (patch) | |
tree | b5433d7e65092ed88a0d4133e9f5015c639542ba /spec | |
parent | 201ce2cb55f1d016cdcb0653d9f9a11a8fec358d (diff) | |
download | gitlab-ce-21937a157d435025d4ae0cf514fe7273302e1004.tar.gz |
Print the setup steps and duration and fix an issue resulting in re-setuping GitLab Shell on each test run35941-fix-testing-issue-following-gitaly-install-fix
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/support/test_env.rb | 23 | ||||
-rw-r--r-- | spec/tasks/gitlab/gitaly_rake_spec.rb | 2 |
2 files changed, 17 insertions, 8 deletions
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb index 4e409df1db6..70bc10ab69a 100644 --- a/spec/support/test_env.rb +++ b/spec/support/test_env.rb @@ -122,23 +122,29 @@ module TestEnv end def setup_gitlab_shell - gitlab_shell_dir = File.dirname(Gitlab.config.gitlab_shell.path) + puts "\n==> Setting up Gitlab Shell..." + start = Time.now + gitlab_shell_dir = Gitlab.config.gitlab_shell.path shell_needs_update = component_needs_update?(gitlab_shell_dir, Gitlab::Shell.version_required) unless !shell_needs_update || system('rake', 'gitlab:shell:install') - puts "rm -rf #{gitlab_shell_dir}" + puts "\nGitLab Shell failed to install, cleaning up #{gitlab_shell_dir}!\n" FileUtils.rm_rf(gitlab_shell_dir) - raise "Can't install gitlab-shell" + exit 1 end + + puts " GitLab Shell setup in #{Time.now - start} seconds...\n" end def setup_gitaly + puts "\n==> Setting up Gitaly..." + start = Time.now socket_path = Gitlab::GitalyClient.address('default').sub(/\Aunix:/, '') gitaly_dir = File.dirname(socket_path) if gitaly_dir_stale?(gitaly_dir) - puts "rm -rf #{gitaly_dir}" + puts " Gitaly is outdated, cleaning up #{gitaly_dir}!" FileUtils.rm_rf(gitaly_dir) end @@ -146,17 +152,20 @@ module TestEnv Gitlab::GitalyClient.expected_server_version) unless !gitaly_needs_update || system('rake', "gitlab:gitaly:install[#{gitaly_dir}]") - puts "rm -rf #{gitaly_dir}" + puts "\nGitaly failed to install, cleaning up #{gitaly_dir}!\n" FileUtils.rm_rf(gitaly_dir) - raise "Can't install gitaly" + exit 1 end start_gitaly(gitaly_dir) + puts " Gitaly setup in #{Time.now - start} seconds...\n" end def gitaly_dir_stale?(dir) gitaly_executable = File.join(dir, 'gitaly') - !File.exist?(gitaly_executable) || (File.mtime(gitaly_executable) < File.mtime(Rails.root.join('GITALY_SERVER_VERSION'))) + return false unless File.exist?(gitaly_executable) + + File.mtime(gitaly_executable) < File.mtime(Rails.root.join('GITALY_SERVER_VERSION')) end def start_gitaly(gitaly_dir) diff --git a/spec/tasks/gitlab/gitaly_rake_spec.rb b/spec/tasks/gitlab/gitaly_rake_spec.rb index 29eec9009bd..bda8db2b77b 100644 --- a/spec/tasks/gitlab/gitaly_rake_spec.rb +++ b/spec/tasks/gitlab/gitaly_rake_spec.rb @@ -41,7 +41,7 @@ describe 'gitlab:gitaly namespace rake task' do end describe 'gmake/make' do - let(:command_preamble) { %w[/usr/bin/env -u BUNDLE_GEMFILE -u RUBYOPT] } + let(:command_preamble) { %w[/usr/bin/env -u RUBYOPT] } before(:all) do @old_env_ci = ENV.delete('CI') |