summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-01-15 16:14:30 +0000
committerRémy Coutable <remy@rymai.me>2018-01-15 16:14:30 +0000
commitc2afd107ca2247e04a32523087a47f9d5309d832 (patch)
tree68921ebfa1f0c4d62a798ffe9f6b6b485ced2056 /spec
parent6b36fff5f5b4ccfce8465a0981062297f3dd1ab6 (diff)
parent4aaf3dae1e1b8c07645095efb6d9028ff49b90bd (diff)
downloadgitlab-ce-c2afd107ca2247e04a32523087a47f9d5309d832.tar.gz
Merge branch 'stop-gitaly-atexit' into 'master'
Use an at_exit hook to stop test gitaly Closes #41991 See merge request gitlab-org/gitlab-ce!16433
Diffstat (limited to 'spec')
-rw-r--r--spec/spec_helper.rb4
-rw-r--r--spec/support/test_env.rb8
2 files changed, 3 insertions, 9 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index f51bb44086b..6186fb92bad 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -97,10 +97,6 @@ RSpec.configure do |config|
TestEnv.init
end
- config.after(:suite) do
- TestEnv.cleanup
- end
-
config.before(:example) do
# Skip pre-receive hook check so we can use the web editor and merge.
allow_any_instance_of(Gitlab::Git::Hook).to receive(:trigger).and_return([true, nil])
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb
index 25ff6094408..fd6368e7b40 100644
--- a/spec/support/test_env.rb
+++ b/spec/support/test_env.rb
@@ -90,10 +90,6 @@ module TestEnv
setup_forked_repo
end
- def cleanup
- stop_gitaly
- end
-
def disable_mailer
allow_any_instance_of(NotificationService).to receive(:mailer)
.and_return(double.as_null_object)
@@ -163,6 +159,8 @@ module TestEnv
spawn_script = Rails.root.join('scripts/gitaly-test-spawn').to_s
@gitaly_pid = Bundler.with_original_env { IO.popen([spawn_script], &:read).to_i }
+ Kernel.at_exit { stop_gitaly }
+
wait_gitaly
end
@@ -309,7 +307,7 @@ module TestEnv
# Before we used Git clone's --mirror option, bare repos could end up
# with missing refs, clearing them and retrying should fix the issue.
- cleanup && clean_gitlab_test_path && init unless reset.call
+ clean_gitlab_test_path && init unless reset.call
end
end