summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkytv <killyourtv@i2pmail.org>2015-07-09 10:19:30 +0000
committerkytv <killyourtv@i2pmail.org>2015-07-09 20:59:42 +0000
commit1e89ccd928c184765965b9d99b7660e643a89622 (patch)
treec215a589d4cad884267ee93f9e2e1a0646d2021e
parent661457b6d58f325b9be93fbcb24123106e9b9ef8 (diff)
Also retry for "Timeout" or "Unable to resolve"
Note we cannot use `execute_successfully` since we want to examine stderr.
-rw-r--r--features/step_definitions/torified_misc.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/features/step_definitions/torified_misc.rb b/features/step_definitions/torified_misc.rb
index 2768f24..d984ae1 100644
--- a/features/step_definitions/torified_misc.rb
+++ b/features/step_definitions/torified_misc.rb
@@ -1,18 +1,28 @@
+class WhoisLookupFailure < StandardError
+end
+
When /^I successfully query the whois directory service for "([^"]+)"$/ do |domain|
next if @skip_steps_while_restoring_background
@new_circuit_tries = 0
until @new_circuit_tries == $config["MAX_NEW_TOR_CIRCUIT_RETRIES"] do
begin
- @vm_execute_res = @vm.execute_successfully("whois '#{domain}'", LIVE_USER)
+ @vm_execute_res = @vm.execute("whois '#{domain}'", LIVE_USER)
assert(!@vm_execute_res.stdout['LIMIT EXCEEDED'])
+ raise WhoisLookupFailure unless @vm_execute_res.success?
break
rescue Test::Unit::AssertionFailedError
force_new_tor_circuit
+ rescue WhoisLookupFailure => e
+ if @vm_execute_res.stderr['Timeout'] || @vm_execute_res.stderr['Unable to resolve']
+ force_new_tor_circuit
+ else
+ raise e
+ end
end
end
assert(@new_circuit_tries < $config["MAX_NEW_TOR_CIRCUIT_RETRIES"],
"Looking up whois info for #{domain} did not succeed after retrying #{@new_circuit_tries} times.\n" +
- "The whois standard output does not contain #{domain}:\n" +
+ "The output of the last command contains:\n" +
"#{@vm_execute_res.stdout}\n" + "#{@vm_execute_res.stderr}")
end