diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2019-02-27 10:58:21 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2019-02-27 10:58:21 +0000 |
commit | 078f11a6b9c0197a3cfde6b3658ca268097e315c (patch) | |
tree | a2253cf873eb585e2a2812ff584cd2e748ed6e02 /spec/support | |
parent | 1b10b77babf008daf337ff194f10508935a8c8a2 (diff) | |
download | gitlab-ce-078f11a6b9c0197a3cfde6b3658ca268097e315c.tar.gz |
Prepare test suite for switch to Gitaly-embedded Git hooks
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/helpers/test_env.rb | 12 |
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 |