Commit 95d1ac0e authored by anonym's avatar anonym
Browse files

Test suite: make chutney_onionservice_redir deal with cleanup of previous instances.

Instead of the caller having to deal with it in each instance.
parent 839ae92c
......@@ -147,18 +147,22 @@ def chutney_onionservice_info
end
def chutney_onionservice_redir(remote_address, remote_port)
local_address, local_port, _ = chutney_onionservice_info
job = IO.popen(
['/usr/bin/redir',
"#{local_address}:#{local_port}",
"#{remote_address}:#{remote_port}"]
)
add_after_scenario_hook do
kill_redir = Proc.new do
begin
Process.kill("TERM", job.pid)
Process.kill("TERM", $chutney_onionservice_job.pid)
rescue
# noop
end
end
return job
if $chutney_onionservice_job
kill_redir.call
end
local_address, local_port, _ = chutney_onionservice_info
$chutney_onionservice_job = IO.popen(
['/usr/bin/redir',
"#{local_address}:#{local_port}",
"#{remote_address}:#{remote_port}"]
)
add_after_scenario_hook { kill_redir.call }
return $chutney_onionservice_job
end
......@@ -46,13 +46,6 @@ When /^the "([^"]+)" OpenPGP key is not in the live user's public keyring$/ do |
end
def setup_onion_keyserver
if @onion_keyserver_job
begin
Process.kill("TERM", @onion_keyserver_job.pid)
rescue
# noop
end
end
resolver = Resolv::DNS.new
keyservers = resolver.getaddresses('pool.sks-keyservers.net').select do |addr|
addr.class == Resolv::IPv4
......
Supports Markdown
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