diff options
-rw-r--r-- | lib/custodian/protocoltest/http.rb | 6 | ||||
-rwxr-xr-x | t/test-custodian-parser.rb | 27 |
2 files changed, 33 insertions, 0 deletions
diff --git a/lib/custodian/protocoltest/http.rb b/lib/custodian/protocoltest/http.rb index 05e71ae..4632630 100644 --- a/lib/custodian/protocoltest/http.rb +++ b/lib/custodian/protocoltest/http.rb @@ -143,6 +143,12 @@ module Custodian if line =~ /with host header '([^']+)'/ @host_override = $1.dup end + + # We can't test on IPv4-only or IPv6-only basis + if line =~ /ipv[46]_only/i + raise ArgumentError, "We cannot limit HTTP/HTTPS tests to IPv4/IPv6-only" + end + end diff --git a/t/test-custodian-parser.rb b/t/test-custodian-parser.rb index d3c3842..bc2bc2b 100755 --- a/t/test-custodian-parser.rb +++ b/t/test-custodian-parser.rb @@ -434,6 +434,33 @@ EOF # + # HTTP/HTTPS tests don't like IPv4/IPv6-limits + # + def test_http_protocols + + parser = Custodian::Parser.new + + # + # A series of tests to parse + # + text = [] + text.push('https://example.com/ must run https ipv4_only') + text.push('https://example.com/ must run https ipv6_only') + text.push('http://example.com/ must run http ipv4_only') + text.push('http://example.com/ must run http ipv6_only') + + # + # Test the parser with this text + # + text.each do |txt| + assert_raise ArgumentError do + parser.parse_lines(txt) + end + end + end + + + # # Test that the text we're going to use in alerters is present. # def test_alert_text |