예제 #1
0
    def test__monitor_process_down_failuer(self, mock_ssh):

        ins = monitor_process.MonitorProcess(self.monitor_cfg, self.context)

        mock_ssh.SSH().execute.return_value = (0, "0", '')
        ins.setup()
        ins.monitor_func()
        ins._result = {"outage_time": 10}
        ins.verify_SLA()
예제 #2
0
    def test__monitor_process_all_successful(self, mock_ssh):

        ins = monitor_process.MonitorProcess(self.monitor_cfg, self.context,
                                             {"nova-api": 10})

        mock_ssh.SSH.from_node().execute.return_value = (0, "1", '')
        ins.setup()
        ins.monitor_func()
        ins._result = {"outage_time": 0}
        ins.verify_SLA()
예제 #3
0
    def test__monitor_process_no_sla(self, mock_ssh):

        monitor_cfg = {
            'monitor_type': 'process',
            'process_name': 'nova-api',
            'host': "node1",
            'monitor_time': 1,
        }
        ins = monitor_process.MonitorProcess(monitor_cfg, self.context,
                                             {"nova-api": 10})

        mock_ssh.SSH.from_node().execute.return_value = (0, "0", '')
        ins.setup()
        ins.monitor_func()
        ins._result = {"outage_time": 10}
        self.assertTrue(ins.verify_SLA())