summaryrefslogtreecommitdiff
path: root/spec/support/helpers/test_env.rb
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2019-02-27 10:58:21 +0000
committerDouwe Maan <douwe@gitlab.com>2019-02-27 10:58:21 +0000
commit078f11a6b9c0197a3cfde6b3658ca268097e315c (patch)
treea2253cf873eb585e2a2812ff584cd2e748ed6e02 /spec/support/helpers/test_env.rb
parent1b10b77babf008daf337ff194f10508935a8c8a2 (diff)
downloadgitlab-ce-078f11a6b9c0197a3cfde6b3658ca268097e315c.tar.gz
Prepare test suite for switch to Gitaly-embedded Git hooks
Diffstat (limited to 'spec/support/helpers/test_env.rb')
-rw-r--r--spec/support/helpers/test_env.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/support/helpers/test_env.rb b/spec/support/helpers/test_env.rb
index 06bcf4f8013..80a22134021 100644
--- a/spec/support/helpers/test_env.rb
+++ b/spec/support/helpers/test_env.rb
@@ -147,12 +147,15 @@ module TestEnv
version: Gitlab::Shell.version_required,
task: 'gitlab:shell:install')
- create_fake_git_hooks
+ # gitlab-shell hooks don't work in our test environment because they try to make internal API calls
+ sabotage_gitlab_shell_hooks
end
- def create_fake_git_hooks
- # gitlab-shell hooks don't work in our test environment because they try to make internal API calls
- hooks_dir = File.join(Gitlab.config.gitlab_shell.path, 'hooks')
+ def sabotage_gitlab_shell_hooks
+ create_fake_git_hooks(Gitlab::Shell.new.hooks_path)
+ end
+
+ def create_fake_git_hooks(hooks_dir)
%w[pre-receive post-receive update].each do |hook|
File.open(File.join(hooks_dir, hook), 'w', 0755) { |f| f.puts '#!/bin/sh' }
end
@@ -169,6 +172,7 @@ module TestEnv
task: "gitlab:gitaly:install[#{install_gitaly_args}]") do
Gitlab::SetupHelper.create_gitaly_configuration(gitaly_dir, { 'default' => repos_path }, force: true)
+ create_fake_git_hooks(File.join(gitaly_dir, 'ruby/git-hooks'))
start_gitaly(gitaly_dir)
end
end