summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkytv <killyourtv@i2pmail.org>2015-07-09 10:04:10 +0000
committerkytv <killyourtv@i2pmail.org>2015-07-09 10:18:34 +0000
commitac9ecf21689a2fc9a646d2cf2f88376692463d67 (patch)
treeda8aa9947545eabb778fbc522d4121e2719692cf
parentee960ba1996eaf585990f34c6d01b412828bb06d (diff)
Use newly created 'force_new_tor_circuit' function
-rw-r--r--features/step_definitions/torified_misc.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/features/step_definitions/torified_misc.rb b/features/step_definitions/torified_misc.rb
index 3b5265b..2768f24 100644
--- a/features/step_definitions/torified_misc.rb
+++ b/features/step_definitions/torified_misc.rb
@@ -1,19 +1,17 @@
When /^I successfully query the whois directory service for "([^"]+)"$/ do |domain|
next if @skip_steps_while_restoring_background
- tries = 0
- until tries == $config["MAX_NEW_TOR_CIRCUIT_RETRIES"] do
+ @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)
assert(!@vm_execute_res.stdout['LIMIT EXCEEDED'])
break
rescue Test::Unit::AssertionFailedError
- tries += 1
- STDERR.puts "Forcing new Tor circuit... (attempt ##{tries})" if $config["DEBUG"]
- step 'I force Tor to use a new circuit'
+ force_new_tor_circuit
end
end
- assert(tries <= $config["MAX_NEW_TOR_CIRCUIT_RETRIES"],
- "Looking up whois info for #{domain} did not succeed after retrying #{tries} times.\n" +
+ 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" +
"#{@vm_execute_res.stdout}\n" + "#{@vm_execute_res.stderr}")
end