Exemplo n.º 1
0
 def test_raise_warning_on_notification_errors(self):
     host = self.sched.hosts.find_by_name("test_host_0")
     host.checks_in_progress = []
     host.act_depend_of = [] # ignore the router
     cmd = "/error/pl"
     #Create a dummy notif
     n = Notification('PROBLEM', 'scheduled', 'BADCOMMAND', cmd, host, None, 0)
     n.execute()
     self.sched.actions[n.id] = n
     self.sched.put_results(n)
     #Should have raised something like "Warning : the notification command 'BADCOMMAND' raised an error (exit code=2) : '[Errno 2] No such file or directory'"
     self.assert_(self.log_match(1, 'BADCOMMAND'))
Exemplo n.º 2
0
 def test_raise_warning_on_notification_errors(self):
     host = self.sched.hosts.find_by_name("test_host_0")
     host.checks_in_progress = []
     host.act_depend_of = []  # ignore the router
     cmd = "/error/pl"
     #Create a dummy notif
     n = Notification('PROBLEM', 'scheduled', 'BADCOMMAND', cmd, host, None,
                      0)
     n.execute()
     self.sched.actions[n.id] = n
     self.sched.put_results(n)
     #Should have raised something like "Warning : the notification command 'BADCOMMAND' raised an error (exit code=2) : '[Errno 2] No such file or directory'"
     self.assert_(self.log_match(1, 'BADCOMMAND'))
Exemplo n.º 3
0
    def test_raise_warning_on_notification_errors(self):
        host = self.sched.hosts.find_by_name("test_host_0")
        host.checks_in_progress = []
        host.act_depend_of = [] # ignore the router
        cmd = "/error/pl"
        #Create a dummy notif
        n = Notification('PROBLEM', 'scheduled', 'BADCOMMAND', cmd, host, None, 0)
        n.execute()
        time.sleep(0.2)
        if n.status is not 'done':
            n.check_finished(8000)
        print n.__dict__
        self.sched.actions[n.id] = n
        self.sched.put_results(n)
        #Should have raised something like "Warning : the notification command 'BADCOMMAND' raised an error (exit code=2) : '[Errno 2] No such file or directory'"
        # Ok, in HUDSON, we got a problem here. so always run with a shell run before release please
        if os.environ.get('HUDSON_URL', None):
            return

        self.assert_(self.any_log_match(u'.*BADCOMMAND.*') or self.any_log_match('.*BADCOMMAND.*'))
    def test_raise_warning_on_notification_errors(self):
        host = self.sched.hosts.find_by_name("test_host_0")
        host.checks_in_progress = []
        host.act_depend_of = []  # ignore the router
        cmd = "/error/pl"
        # Create a dummy notif
        n = Notification('PROBLEM', 'scheduled', 'BADCOMMAND', cmd, host, None,
                         0)
        n.execute()
        time.sleep(0.2)
        if n.status is not 'done':
            n.check_finished(8000)
        print n.__dict__
        self.sched.actions[n.id] = n
        self.sched.put_results(n)
        # Should have raised something like "Warning: the notification command 'BADCOMMAND' raised an error (exit code=2): '[Errno 2] No such file or directory'"
        # Ok, in HUDSON, we got a problem here. so always run with a shell run before release please
        if os.environ.get('HUDSON_URL', None):
            return

        self.assert_any_log_match('.*BADCOMMAND.*')