예제 #1
0
 def test_missing_configs(self):
     """
 Check that the status is UNKNOWN when configs are missing.
 """
     configs = None
     [status, messages] = alert_sync_status.execute(configurations=configs)
     self.assertEqual(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.')
예제 #2
0
    def test_no_standby_state(self, get_sync_status_mock):
        """
    Test that the status is SKIPPED when HAWQSTANDBY is not in configurations
    """
        configs = {"{{hawq-site/hawq_master_address_port}}": "5432"}

        # Mock calls
        get_sync_status_mock.return_value = 'Not Configured'

        [status, messages] = alert_sync_status.execute(configurations=configs)
        self.assertEqual(status, RESULT_STATE_SKIPPED)
        self.assertTrue(messages is not None and len(messages) == 1)
        self.assertEqual(messages[0], 'HAWQSTANDBY is not installed.')
예제 #3
0
    def test_unknown_state(self, get_sync_status_mock):
        """
    Test that the status is UNKNOWN when HAWQMASTER returns summary_state as 'Unknown'
    """
        configs = {
            "{{hawq-site/hawq_master_address_port}}": "5432",
            "{{hawq-site/hawq_standby_address_host}}":
            "c6402.ambari.apache.org"
        }

        # Mock calls
        get_sync_status_mock.return_value = 'Unknown'

        [status, messages] = alert_sync_status.execute(configurations=configs)
        self.assertEqual(status, RESULT_STATE_UNKNOWN)
        self.assertTrue(messages is not None and len(messages) == 1)
        self.assertEqual(messages[0], 'Sync status cannot be determined.')
예제 #4
0
    def test_synchronized_state(self, get_sync_status_mock):
        """
    Test that the status is OK when HAWQSTANDBY is 'Synchronized' with HAWQMASTER
    """
        configs = {
            "{{hawq-site/hawq_master_address_port}}": "5432",
            "{{hawq-site/hawq_standby_address_host}}":
            "c6402.ambari.apache.org"
        }

        # Mock calls
        get_sync_status_mock.return_value = 'Synchronized'

        [status, messages] = alert_sync_status.execute(configurations=configs)
        self.assertEqual(status, RESULT_STATE_OK)
        self.assertTrue(messages is not None and len(messages) == 1)
        self.assertEqual(messages[0],
                         'HAWQSTANDBY is in sync with HAWQMASTER.')