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 | c31a047c7ecf949b3cf8369985946f563957bf0a (patch) | |
tree | daa4a5bc7db319540d31c873a32f7c58b411f8b3 /lib/custodian/protocoltest/mx.rb | |
parent | 3d15acf163a514816f3d2e2d08730dfb708fe5fd (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 |