Ejemplo n.º 1
0
 def test_missing_configs(self):
     """
 Check that the status is UNKNOWN when configs are missing.
 """
     configs = None
     [status,
      messages] = alert_component_status.execute(configurations=configs)
     self.assertEqual(status, alert_component_status.RESULT_STATE_UNKNOWN)
     self.assertTrue(messages is not None and len(messages) == 1)
     self.assertEqual(
         messages[0],
         'There were no configurations supplied to the script.')
Ejemplo n.º 2
0
    def test_hawq_master_critical(self, is_component_running_mock):
        """
    Test that the status is CRITICIAL when HAWQ Master is down
    """
        # Mock calls
        is_component_running_mock.return_value = False

        [status, messages] = alert_component_status.execute(
            configurations=WORKING_CONFIGS,
            parameters={'component_name': 'master'})
        self.assertEqual(status, alert_component_status.RESULT_STATE_CRITICAL)
        self.assertTrue(messages is not None and len(messages) == 1)
        self.assertEqual(messages[0], 'HAWQ Master is not running')
Ejemplo n.º 3
0
    def test_hawq_segment_ok(self, is_component_running_mock):
        """
    Test that the status is OK when HAWQ Segment is up
    """
        # Mock calls
        is_component_running_mock.return_value = True

        [status, messages] = alert_component_status.execute(
            configurations=WORKING_CONFIGS,
            parameters={'component_name': 'segment'})
        self.assertEqual(status, alert_component_status.RESULT_STATE_OK)
        self.assertTrue(messages is not None and len(messages) == 1)
        self.assertEqual(messages[0], 'HAWQ Segment is running')