summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2015-02-17 20:52:41 +0000
committerSteve Kemp <steve@steve.org.uk>2015-02-17 20:52:41 +0000
commitb1b8ec280c5848fd4485a5106a58ea98c37dc905 (patch)
treecca4643c8fa5bfed3c078cbc660cccddf8c306c2 /lib
parentf150b7ea0951fc92c4f92b7ef890c7ee305cc82c (diff)
Deal with multiple test-implementations.
As soon as we allow multiple test-implementations we get into a mess, as Mauve regards an ID as unique and that is based upon the test-definition not the implementing method We want to allow: * HTTPS test to succeed. * SSL-check to fail. Which means multiple tests of type "https" will have different IDs. Force this by adding on the class of the implementation.
Diffstat (limited to 'lib')
-rw-r--r--lib/custodian/alerts/mauve.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/custodian/alerts/mauve.rb b/lib/custodian/alerts/mauve.rb
index 66379a5..9a5d9ed 100644
--- a/lib/custodian/alerts/mauve.rb
+++ b/lib/custodian/alerts/mauve.rb
@@ -213,14 +213,20 @@ module Custodian
test_host = test.target
test_type = test.get_type
-
alert = Mauve::Proto::Alert.new
#
# Mauve only lets us use IDs which are <= 255 characters in length
# hash the line from the parser to ensure it is short enough.
# (IDs must be unique, per-source)
- alert.id = Digest::SHA1.hexdigest(test.to_s)
+ #
+ # Because there might be N-classes which implemented the test
+ # we need to make sure these are distinct too.
+ #
+ id_key = test.to_s
+ id_key += test.class
+
+ alert.id = Digest::SHA1.hexdigest(id_key)
alert.subject = subject
alert.summary = "The #{test_type} test failed against #{test_host}"