diff options
author | Rémy Coutable <remy@rymai.me> | 2017-08-02 12:39:16 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-08-02 20:02:01 +0300 |
commit | 6a29d3a4875fa25bfe3ea0a8afb747cb7708e6a1 (patch) | |
tree | 1514905cecc0f7f9914a80f168242264471d37ab /spec/support/test_env.rb | |
parent | 88958e5a9cd364ae36f3d2837982cedb9239c3bc (diff) |
Ensure we run installation Rake tasks in a clean env in TestEnv
If we call `system('rake', 'taks_name')`, `ENV['RUBYOPT']` is set to
`'-rbundler/setup'` but some tasks (e.g. `gitlab:gitaly:install` need
a clean env since they install their own Gem bundle.
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/support/test_env.rb')
-rw-r--r-- | spec/support/test_env.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb index f0603dfadde..8a509cf8a9c 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 = {}) + Gitlab::Application.load_tasks + # Disable mailer for spinach tests disable_mailer if opts[:mailer] == false @@ -122,11 +124,13 @@ 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' + 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 @@ -136,8 +140,9 @@ 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" + 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) |