[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a
Naparuba
naparuba at gmail.com
Tue Feb 28 22:21:07 UTC 2012
The following commit has been merged in the debian/master branch:
commit e87583488eaa5d121b050f46aa4978f78549a3a2
Author: Naparuba <naparuba at gmail.com>
Date: Thu Feb 16 14:53:44 2012 +0100
Add : test case about Xof: rule with jsut hosts?
diff --git a/test/etc/business_correlator/services.cfg b/test/etc/business_correlator/services.cfg
index fc2879d..efb6667 100644
--- a/test/etc/business_correlator/services.cfg
+++ b/test/etc/business_correlator/services.cfg
@@ -173,3 +173,11 @@ define service{
service_description Simple_And_not
use generic-service
}
+
+
+define service{
+ check_command bp_rule!1 of: test_host_0|test_router_0
+ host_name test_host_0
+ service_description Simple_1Of_with_host
+ use generic-service
+}
\ No newline at end of file
diff --git a/test/test_business_correlator.py b/test/test_business_correlator.py
index b546c77..f367ab1 100755
--- a/test/test_business_correlator.py
+++ b/test/test_business_correlator.py
@@ -321,6 +321,44 @@ class TestBusinesscorrel(ShinkenTest):
+
+
+ # We will try a simple 1of: test_router_0 OR/AND test_host_0
+ def test_simple_1of_business_correlator_with_hosts(self):
+ #
+ # Config is not correct because of a wrong relative path
+ # in the main config file
+ #
+ print "Get the hosts and services"
+ now = time.time()
+ host = self.sched.hosts.find_by_name("test_host_0")
+ host.checks_in_progress = []
+ host.act_depend_of = [] # ignore the router
+ router = self.sched.hosts.find_by_name("test_router_0")
+ router.checks_in_progress = []
+ router.act_depend_of = [] # ignore the router
+
+ svc_cor = self.sched.services.find_srv_by_name_and_hostname("test_host_0", "Simple_1Of_with_host")
+ self.assert_(svc_cor.got_business_rule == True)
+ self.assert_(svc_cor.business_rule is not None)
+ bp_rule = svc_cor.business_rule
+ self.assert_(bp_rule.operand == 'of:')
+ # Simple 1of: so in fact a triple (1,2,2) (1of and MAX,MAX
+ self.assert_(bp_rule.of_values == (1,2,2))
+
+
+ sons = bp_rule.sons
+ print "Sons,", sons
+ # We've got 2 sons, 2 services nodes
+ self.assert_(len(sons) == 2)
+ self.assert_(sons[0].operand == 'host')
+ self.assert_(sons[0].sons[0] == host)
+ self.assert_(sons[1].operand == 'host')
+ self.assert_(sons[1].sons[0] == router)
+
+
+
+
# We will try a simple bd1 OR db2, but this time we will
# schedule a real check and see if it's good
def test_simple_or_business_correlator_with_schedule(self):
--
UNNAMED PROJECT
More information about the Pkg-nagios-changes
mailing list