summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@gitlab.com>2019-06-17 17:32:58 +0000
committerBob Van Landuyt <bob@gitlab.com>2019-06-17 17:32:58 +0000
commite6059b3d8d6277e068633a867f539b281f872938 (patch)
treeca605408667d0d76deffffaa5241ecee217ffa8f
parent2634cad695e41f4882a67a8cfa0e2579b870f1a3 (diff)
parent679ac7f78efe91e3544d603839a12f00a414691e (diff)
downloadgitlab-ce-e6059b3d8d6277e068633a867f539b281f872938.tar.gz
Merge branch 'zj-disable-hooks-testing' into 'master'
Disable hooks by setting an ENV var See merge request gitlab-org/gitlab-ce!29672
-rw-r--r--scripts/gitaly_test.rb5
-rw-r--r--spec/support/helpers/test_env.rb14
2 files changed, 4 insertions, 15 deletions
diff --git a/scripts/gitaly_test.rb b/scripts/gitaly_test.rb
index b5d3facd18a..b5cc5118530 100644
--- a/scripts/gitaly_test.rb
+++ b/scripts/gitaly_test.rb
@@ -23,7 +23,10 @@ module GitalyTest
'BUNDLE_FLAGS' => "--jobs=4 --retry=3",
'BUNDLE_INSTALL_FLAGS' => nil,
'BUNDLE_GEMFILE' => gemfile,
- 'RUBYOPT' => nil
+ 'RUBYOPT' => nil,
+
+ # Git hooks can't run during tests as the internal API is not running.
+ 'GITALY_TESTING_NO_GIT_HOOKS' => "1"
}
if ENV['CI']
diff --git a/spec/support/helpers/test_env.rb b/spec/support/helpers/test_env.rb
index 06b5ecdf150..77f22d9dd24 100644
--- a/spec/support/helpers/test_env.rb
+++ b/spec/support/helpers/test_env.rb
@@ -146,19 +146,6 @@ module TestEnv
install_dir: Gitlab.config.gitlab_shell.path,
version: Gitlab::Shell.version_required,
task: 'gitlab:shell:install')
-
- # gitlab-shell hooks don't work in our test environment because they try to make internal API calls
- sabotage_gitlab_shell_hooks
- end
-
- 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
end
def setup_gitaly
@@ -172,7 +159,6 @@ 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