From 805a28e6a134b59ab3efa3ff6d6b0e16bd24c950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Fri, 4 Aug 2017 15:59:30 +0200 Subject: Revert "Merge branch 'fix-gitaly-install' into 'master'" This reverts commit 23c502b43404aa70741462da5d57c23196f6088a, reversing changes made to 1018ab0516fd94d1ffbc05a0ad8499947dd9630d. --- spec/support/test_env.rb | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'spec/support/test_env.rb') diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb index bed78928f14..7995b5893e2 100644 --- a/spec/support/test_env.rb +++ b/spec/support/test_env.rb @@ -63,8 +63,6 @@ module TestEnv # See gitlab.yml.example test section for paths # def init(opts = {}) - Rake.application.rake_require 'tasks/gitlab/helpers' - Rake::Task.define_task :environment # Disable mailer for spinach tests disable_mailer if opts[:mailer] == false @@ -124,14 +122,11 @@ module TestEnv end def setup_gitlab_shell - gitlab_shell_dir = File.dirname(Gitlab.config.gitlab_shell.path) - gitlab_shell_needs_update = component_needs_update?(gitlab_shell_dir, + shell_needs_update = component_needs_update?(Gitlab.config.gitlab_shell.path, Gitlab::Shell.version_required) - Rake.application.rake_require 'tasks/gitlab/shell' - unless !gitlab_shell_needs_update || Rake.application.invoke_task('gitlab:shell:install') - FileUtils.rm_rf(gitlab_shell_dir) - raise "Can't install gitlab-shell" + unless !shell_needs_update || system('rake', 'gitlab:shell:install') + raise 'Can`t clone gitlab-shell' end end @@ -147,10 +142,8 @@ module TestEnv gitaly_needs_update = component_needs_update?(gitaly_dir, Gitlab::GitalyClient.expected_server_version) - Rake.application.rake_require 'tasks/gitlab/gitaly' - unless !gitaly_needs_update || Rake.application.invoke_task("gitlab:gitaly:install[#{gitaly_dir}]") - FileUtils.rm_rf(gitaly_dir) - raise "Can't install gitaly" + unless !gitaly_needs_update || system('rake', "gitlab:gitaly:install[#{gitaly_dir}]") + raise "Can't clone gitaly" end start_gitaly(gitaly_dir) -- cgit v1.2.1 From 201ce2cb55f1d016cdcb0653d9f9a11a8fec358d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Fri, 4 Aug 2017 16:05:41 +0200 Subject: Unset the RUBYOPT env variable before installing gitaly-ruby MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- spec/support/test_env.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'spec/support/test_env.rb') diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb index 7995b5893e2..4e409df1db6 100644 --- a/spec/support/test_env.rb +++ b/spec/support/test_env.rb @@ -122,11 +122,14 @@ module TestEnv end def setup_gitlab_shell - shell_needs_update = component_needs_update?(Gitlab.config.gitlab_shell.path, + gitlab_shell_dir = File.dirname(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') - raise 'Can`t clone gitlab-shell' + puts "rm -rf #{gitlab_shell_dir}" + FileUtils.rm_rf(gitlab_shell_dir) + raise "Can't install gitlab-shell" end end @@ -136,14 +139,16 @@ module TestEnv if gitaly_dir_stale?(gitaly_dir) puts "rm -rf #{gitaly_dir}" - FileUtils.rm_rf(gitaly_dir) + FileUtils.rm_rf(gitaly_dir) end gitaly_needs_update = component_needs_update?(gitaly_dir, Gitlab::GitalyClient.expected_server_version) unless !gitaly_needs_update || system('rake', "gitlab:gitaly:install[#{gitaly_dir}]") - raise "Can't clone gitaly" + puts "rm -rf #{gitaly_dir}" + FileUtils.rm_rf(gitaly_dir) + raise "Can't install gitaly" end start_gitaly(gitaly_dir) -- cgit v1.2.1 From 21937a157d435025d4ae0cf514fe7273302e1004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Fri, 4 Aug 2017 17:27:50 +0200 Subject: Print the setup steps and duration and fix an issue resulting in re-setuping GitLab Shell on each test run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- spec/support/test_env.rb | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'spec/support/test_env.rb') 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) -- cgit v1.2.1