Manual test suite: use more precise data when comparing image size.
[tails.git] / features / step_definitions / firewall_leaks.rb
blob0cd94cca0b186653af9c5d1038be600074e125fa
1 Then(/^the firewall leak detector has detected leaks$/) do
2   assert_raise(FirewallAssertionFailedError) do
3     step 'all Internet traffic has only flowed through Tor'
4   end
5 end
7 Given(/^I disable Tails' firewall$/) do
8   $vm.execute("/usr/local/lib/do_not_ever_run_me")
9   iptables = $vm.execute("iptables -L -n -v").stdout.chomp.split("\n")
10   for line in iptables do
11     if !line[/Chain (INPUT|OUTPUT|FORWARD) \(policy ACCEPT/] and
12        !line[/pkts[[:blank:]]+bytes[[:blank:]]+target/] and
13        !line.empty?
14       raise "The Tails firewall was not successfully disabled:\n#{iptables}"
15     end
16   end
17 end
19 When(/^I do a TCP DNS lookup of "(.*?)"$/) do |host|
20   lookup = $vm.execute("host -T -t A #{host} #{SOME_DNS_SERVER}", :user => LIVE_USER)
21   assert(lookup.success?, "Failed to resolve #{host}:\n#{lookup.stdout}")
22 end
24 When(/^I do a UDP DNS lookup of "(.*?)"$/) do |host|
25   lookup = $vm.execute("host -t A #{host} #{SOME_DNS_SERVER}", :user => LIVE_USER)
26   assert(lookup.success?, "Failed to resolve #{host}:\n#{lookup.stdout}")
27 end
29 When(/^I send some ICMP pings$/) do
30   # We ping an IP address to avoid a DNS lookup
31   ping = $vm.execute("ping -c 5 #{SOME_DNS_SERVER}")
32   assert(ping.success?, "Failed to ping #{SOME_DNS_SERVER}:\n#{ping.stderr}")
33 end