Commit 2f66e859 authored by intrigeri's avatar intrigeri
Browse files

Test suite: escape regexp special characters when constructing the firewall log parsing regexp.

.. and pass -P to grep, since Ruby uses PCRE.
parent 91300962
...@@ -160,9 +160,11 @@ Then /^the firewall is configured to block all IPv6 traffic$/ do ...@@ -160,9 +160,11 @@ Then /^the firewall is configured to block all IPv6 traffic$/ do
end end
def firewall_has_dropped_packet_to?(proto, host, port) def firewall_has_dropped_packet_to?(proto, host, port)
regex = "^Dropped outbound packet: .* DST=#{host} .* PROTO=#{proto} " regex = "^Dropped outbound packet: .* "
regex += "DST=#{Regexp.escape(host)} .* "
regex += "PROTO=#{Regexp.escape(proto)} "
regex += ".* DPT=#{port} " if port regex += ".* DPT=#{port} " if port
$vm.execute("journalctl --dmesg --output=cat | grep -q '#{regex}'").success? $vm.execute("journalctl --dmesg --output=cat | grep -qP '#{regex}'").success?
end end
When /^I open an untorified (TCP|UDP|ICMP) connections to (\S*)(?: on port (\d+))? that is expected to fail$/ do |proto, host, port| When /^I open an untorified (TCP|UDP|ICMP) connections to (\S*)(?: on port (\d+))? that is expected to fail$/ do |proto, host, port|
......
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