diff options
author | Rémy Coutable <remy@rymai.me> | 2017-08-03 14:36:41 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-08-03 14:36:41 +0300 |
commit | 23c502b43404aa70741462da5d57c23196f6088a (patch) | |
tree | 0c2b5ed1c25548d67555e9309f59d1af542248c8 /spec/support/test_env.rb | |
parent | 1018ab0516fd94d1ffbc05a0ad8499947dd9630d (diff) | |
parent | 532ad2e56e10ff0e7922980d48a8c639efac8809 (diff) |
Merge branch 'fix-gitaly-install' into 'master'
Ensure we run installation Rake tasks in a clean env in TestEnv
Closes #35859
See merge request !13249
Diffstat (limited to 'spec/support/test_env.rb')
-rw-r--r-- | spec/support/test_env.rb | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb index 7995b5893e2..bed78928f14 100644 --- a/spec/support/test_env.rb +++ b/spec/support/test_env.rb @@ -63,6 +63,8 @@ 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 @@ -122,11 +124,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) + gitlab_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' + 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" end end @@ -142,8 +147,10 @@ module TestEnv 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" + 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" end start_gitaly(gitaly_dir) |