3 ##############################################################################
4 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
13 # yardstick.benchmark.scenarios.availability.monitor.monitor_process
15 from __future__ import absolute_import
19 from yardstick.benchmark.scenarios.availability.monitor import monitor_process
23 'yardstick.benchmark.scenarios.availability.monitor.monitor_process.ssh')
24 class MonitorProcessTestCase(unittest.TestCase):
30 "key_filename": "/root/.ssh/id_rsa"
32 self.context = {"node1": host}
34 'monitor_type': 'process',
35 'process_name': 'nova-api',
38 'sla': {'max_recover_time': 5}
41 def test__monitor_process_all_successful(self, mock_ssh):
43 ins = monitor_process.MonitorProcess(self.monitor_cfg, self.context)
45 mock_ssh.SSH.from_node().execute.return_value = (0, "1", '')
48 ins._result = {"outage_time": 0}
51 def test__monitor_process_down_failuer(self, mock_ssh):
53 ins = monitor_process.MonitorProcess(self.monitor_cfg, self.context)
55 mock_ssh.SSH.from_node().execute.return_value = (0, "0", '')
58 ins._result = {"outage_time": 10}