Commit ba920f22 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'ee-stop-gitaly-atexit' into 'master'

Use an at_exit hook to stop test gitaly

See merge request gitlab-org/gitlab-ee!4088
parents 5ede859a 83f25739
...@@ -109,10 +109,6 @@ RSpec.configure do |config| ...@@ -109,10 +109,6 @@ RSpec.configure do |config|
TestLicense.init TestLicense.init
end end
config.after(:suite) do
TestEnv.cleanup
end
config.before(:example) do config.before(:example) do
# Skip pre-receive hook check so we can use the web editor and merge. # 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]) allow_any_instance_of(Gitlab::Git::Hook).to receive(:trigger).and_return([true, nil])
......
...@@ -91,10 +91,6 @@ module TestEnv ...@@ -91,10 +91,6 @@ module TestEnv
setup_forked_repo setup_forked_repo
end end
def cleanup
stop_gitaly
end
def disable_mailer def disable_mailer
allow_any_instance_of(NotificationService).to receive(:mailer) allow_any_instance_of(NotificationService).to receive(:mailer)
.and_return(double.as_null_object) .and_return(double.as_null_object)
...@@ -164,6 +160,8 @@ module TestEnv ...@@ -164,6 +160,8 @@ module TestEnv
spawn_script = Rails.root.join('scripts/gitaly-test-spawn').to_s spawn_script = Rails.root.join('scripts/gitaly-test-spawn').to_s
@gitaly_pid = Bundler.with_original_env { IO.popen([spawn_script], &:read).to_i } @gitaly_pid = Bundler.with_original_env { IO.popen([spawn_script], &:read).to_i }
Kernel.at_exit { stop_gitaly }
wait_gitaly wait_gitaly
end end
...@@ -310,7 +308,7 @@ module TestEnv ...@@ -310,7 +308,7 @@ module TestEnv
# Before we used Git clone's --mirror option, bare repos could end up # Before we used Git clone's --mirror option, bare repos could end up
# with missing refs, clearing them and retrying should fix the issue. # 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
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment