diff options
author | Steve Kemp <steve@steve.org.uk> | 2015-04-16 16:14:06 +0100 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2015-04-16 16:14:06 +0100 |
commit | 91713ef347d49dca7de7dd9360d42763dd961894 (patch) | |
tree | 99f8d3e0ff368cc7bb863cdf7910ffcc629774d4 /lib/custodian/protocoltest/mx.rb | |
parent | 1b9654c79d6bd8e24134ddeef4bf44580a726178 (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/mx.rb')
-rw-r--r-- | lib/custodian/protocoltest/mx.rb | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/lib/custodian/protocoltest/mx.rb b/lib/custodian/protocoltest/mx.rb index 3770686..cd5e58e 100644 --- a/lib/custodian/protocoltest/mx.rb +++ b/lib/custodian/protocoltest/mx.rb @@ -1,4 +1,5 @@ -require 'custodian/protocoltest/tcp' +require 'custodian/settings' +require 'custodian/testfactory' # # The MX (DNS + smtp) test. @@ -28,12 +29,6 @@ module Custodian # The main domain we're querying @host = line.split(/\s+/)[0] - if line =~ /must\s+not\s+run\s+/ - @inverted = true - else - @inverted = false - end - end @@ -78,7 +73,7 @@ module Custodian end rescue Timeout::Error => e @error = "Timed-out performing DNS lookups: #{e}" - return nil + return Custodian::TestResult::TEST_FAILED end # @@ -92,7 +87,7 @@ module Custodian # if mx.empty? then @error = "Failed to perform DNS lookup of MX record(s) for host #{@host}" - return false + return Custodian::TestResult::TEST_FAILED end @@ -130,7 +125,7 @@ module Custodian error += "Error connecting to #{backend}:25. " end end - rescue Timeout::Error => ex + rescue Timeout::Error => _ex # Timeout failed += 1 error += "Timeout connecting to #{backend}:25. " @@ -142,9 +137,9 @@ module Custodian # if failed > 0 @error = "There are #{mx.size} hosts running as MX-servers for domain #{@host} - #{passed}:OK #{failed}:FAILED - #{error}" - return false + return Custodian::TestResult::TEST_FAILED else - return true + return Custodian::TestResult::TEST_PASSED end end |