summaryrefslogtreecommitdiff
path: root/lib/custodian/protocoltest/dns.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2015-04-16 16:14:06 +0100
committerSteve Kemp <steve@steve.org.uk>2015-04-16 16:14:06 +0100
commit91713ef347d49dca7de7dd9360d42763dd961894 (patch)
tree99f8d3e0ff368cc7bb863cdf7910ffcc629774d4 /lib/custodian/protocoltest/dns.rb
parent1b9654c79d6bd8e24134ddeef4bf44580a726178 (diff)
Updated test-handler for new API.
This update consists of two changes: * No longer return "true" or "false" instead return "TEST_FAILED", or "TEST_SUCCEEDED". * Removed the testing of test-inversion from the class, now it lives in the base-class where it should have done all along.
Diffstat (limited to 'lib/custodian/protocoltest/dns.rb')
-rw-r--r--lib/custodian/protocoltest/dns.rb20
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/custodian/protocoltest/dns.rb b/lib/custodian/protocoltest/dns.rb
index 4685029..b7e75c0 100644
--- a/lib/custodian/protocoltest/dns.rb
+++ b/lib/custodian/protocoltest/dns.rb
@@ -1,4 +1,5 @@
require 'custodian/settings'
+require 'custodian/testfactory'
require 'custodian/util/dns'
require 'resolv'
@@ -44,15 +45,6 @@ module Custodian
#
@line = line
- #
- # Is this test inverted?
- #
- if line =~ /must\s+not\s+run\s+/
- @inverted = true
- else
- @inverted = false
- end
-
if line =~ /for\s+([^\s]+)\sresolving\s([A-Z]+)\s+as\s'([^']+)'/
@resolve_name = $1.dup
@resolve_type = $2.dup
@@ -107,7 +99,7 @@ module Custodian
# Do the lookup
#
results = resolve_via(@host, resolve_type, resolve_name, period)
- return false if results.nil?
+ return Custodian::TestResult::TEST_FAILED if results.nil?
#
# OK we have an array of results. If every one of the expected
@@ -116,9 +108,15 @@ module Custodian
if !(results - @resolve_expected).empty? or !(@resolve_expected - results).empty?
@error = "DNS server *#{@host}* (#{@server_ip}) returned the wrong records for @#{resolve_name} IN #{resolve_type}@.\n\nWe expected '#{resolve_expected.join(',')}', but we received '#{results.join(',')}'\n"
+ return Custodian::TestResult::TEST_FAILED
end
- @error.nil?
+ #
+ # We were valid.
+ #
+ @error = ''
+ Custodian::TestResult::TEST_PASSED
+
end