diff options
author | Philip Hands <phil@hands.com> | 2016-03-14 15:36:16 +0100 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2016-04-28 21:52:10 +0200 |
commit | da080c472fc415b0ce918f4dd4a1ab143bb1bca4 (patch) | |
tree | bf63179f32f0eda0c2d5796e3e31c18c3c1185cf /features/step_definitions/torified_misc.rb | |
parent | 26a9e8ec2bcae03db4d663d87b44d8708d64fdc2 (diff) | |
download | jenkins.debian.net-da080c472fc415b0ce918f4dd4a1ab143bb1bca4.tar.xz |
rough attempt to grab the good cucumber bits from recent tails
Diffstat (limited to 'features/step_definitions/torified_misc.rb')
-rw-r--r-- | features/step_definitions/torified_misc.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/features/step_definitions/torified_misc.rb b/features/step_definitions/torified_misc.rb new file mode 100644 index 00000000..7112776a --- /dev/null +++ b/features/step_definitions/torified_misc.rb @@ -0,0 +1,41 @@ +When /^I query the whois directory service for "([^"]+)"$/ do |domain| + retry_tor do + @vm_execute_res = $vm.execute("whois '#{domain}'", :user => LIVE_USER) + if @vm_execute_res.failure? || @vm_execute_res.stdout['LIMIT EXCEEDED'] + raise "Looking up whois info for #{domain} failed with:\n" + + "#{@vm_execute_res.stdout}\n" + + "#{@vm_execute_res.stderr}" + end + end +end + +When /^I wget "([^"]+)" to stdout(?:| with the '([^']+)' options)$/ do |url, options| + arguments = "-O - '#{url}'" + arguments = "#{options} #{arguments}" if options + retry_tor do + @vm_execute_res = $vm.execute("wget #{arguments}", :user => LIVE_USER) + if @vm_execute_res.failure? + raise "wget:ing #{url} with options #{options} failed with:\n" + + "#{@vm_execute_res.stdout}\n" + + "#{@vm_execute_res.stderr}" + end + end +end + +Then /^the (wget|whois) command is successful$/ do |command| + assert( + @vm_execute_res.success?, + "#{command} failed:\n" + + "#{@vm_execute_res.stdout}\n" + + "#{@vm_execute_res.stderr}" + ) +end + +Then /^the (wget|whois) standard output contains "([^"]+)"$/ do |command, text| + assert( + @vm_execute_res.stdout[text], + "The #{command} standard output does not contain #{text}:\n" + + "#{@vm_execute_res.stdout}\n" + + "#{@vm_execute_res.stderr}" + ) +end |