def test_down_then_back_up_begin_of_epoch(self): print "test_down_then_back_up_begin_of_epoch" replace_cache("test_could_not_be_restarted", NOTIFY_BEGIN_OF_EPOCH) sctl = TestSystemControl(system_status=SystemControl.SYSTEM_UP) sm = ping_openchannel.process(URL, 0, False, sctl) self.assertTrue(sctl.is_system_up()) self.assertEqual("System status: up", sm.subject) self.assertTrue(sm.is_current_state_emailed) self.assertTrue("Localhost is back up" in sm.get_message_content()) self.assertFalse(is_notify_cache())
def test_up_and_still_up(self): print "test_up_and_still_up" clear_notify_cache() sctl = TestSystemControl(system_status=SystemControl.SYSTEM_UP) sm = ping_openchannel.process(URL, 0, False, sctl) self.assertTrue(sctl.is_system_up()) self.assertFalse(sm.is_current_state_emailed) self.assertEqual("System status: up", sm.subject) self.assertEquals("", sm.get_message_content()) self.assertFalse(is_notify_cache())
def test_up_and_then_down_and_no_restart(self): print "test_up_and_then_down_and_no_restart" clear_notify_cache() sctl = TestSystemControl(system_status=SystemControl.SYSTEM_DOWN, no_restart_on_bounce=True) sm = ping_openchannel.process(URL, 0, False, sctl) self.assertFalse(sctl.is_system_up()) self.assertTrue(sm.is_current_state_emailed) self.assertEqual("System status: down", sm.subject) self.assertTrue("Localhost is not responding...attempting restart" in sm.get_message_content()) self.assertTrue("Localhost could not be restarted" in sm.get_message_content()) self.assertTrue(is_notify_cache())
def test_down_then_down_then_back_up(self): print "test_down_then_down_then_back_up" replace_cache("test_could_not_be_restarted", NOTIFY_TODAY) sctl = TestSystemControl(system_status=SystemControl.SYSTEM_DOWN) sm = ping_openchannel.process(URL, 0, False, sctl) self.assertTrue(sctl.is_system_up()) self.assertTrue(sm.is_current_state_emailed) self.assertEqual("System status: up", sm.subject) self.assertTrue("Localhost is not responding...attempting restart" in sm.get_message_content()) self.assertTrue("Localhost has been successfully restarted" in sm.get_message_content()) self.assertFalse(is_notify_cache())