diff options
author | Rémy Coutable <remy@rymai.me> | 2017-08-08 12:39:49 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-08-08 12:39:49 +0300 |
commit | feb8974cc87455328dea708be556e41b59e8ba26 (patch) | |
tree | b19b97094cd9296b049dcd2112cb9d1fd4e38edc /spec/support/test_env.rb | |
parent | 079df3121409198bcba232a1678125a6c83118de (diff) | |
parent | 21937a157d435025d4ae0cf514fe7273302e1004 (diff) |
Merge branch '35941-fix-testing-issue-following-gitaly-install-fix' into 'master'
Unset the `RUBYOPT` env variable before installing `gitaly-ruby`
Closes #35941 and #35967
See merge request !13313
Diffstat (limited to 'spec/support/test_env.rb')
-rw-r--r-- | spec/support/test_env.rb | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb index c1298ed9cae..e059c9620ab 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,41 +122,50 @@ 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, + 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) - Rake.application.rake_require 'tasks/gitlab/shell' - unless !gitlab_shell_needs_update || Rake.application.invoke_task('gitlab:shell:install') + unless !shell_needs_update || system('rake', 'gitlab:shell:install') + 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}" - FileUtils.rm_rf(gitaly_dir) + puts " Gitaly is outdated, cleaning up #{gitaly_dir}!" + FileUtils.rm_rf(gitaly_dir) end 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}]") + unless !gitaly_needs_update || system('rake', "gitlab:gitaly:install[#{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) |