diff options
12 files changed, 45 insertions, 31 deletions
diff --git a/docs/userguide/opnfv_yardstick_tc046.rst b/docs/userguide/opnfv_yardstick_tc046.rst index 612676434..cce6c6884 100644 --- a/docs/userguide/opnfv_yardstick_tc046.rst +++ b/docs/userguide/opnfv_yardstick_tc046.rst @@ -2,7 +2,7 @@ .. License. .. http://creativecommons.org/licenses/by/4.0 .. (c) OPNFV, Yin Kanglin and others. -.. 14_ykl@tongji.edu.cn +.. 14_ykl@tongji.edu.cn ************************************* Yardstick Test Case Description TC046 diff --git a/tests/unit/benchmark/scenarios/availability/test_attacker_general.py b/tests/unit/benchmark/scenarios/availability/test_attacker_general.py index d6488a9a7..643c1e7ac 100644 --- a/tests/unit/benchmark/scenarios/availability/test_attacker_general.py +++ b/tests/unit/benchmark/scenarios/availability/test_attacker_general.py @@ -32,7 +32,7 @@ class GeneralAttackerServiceTestCase(unittest.TestCase): 'fault_type': 'general-attacker', 'action_parameter':{'process_name':'nova_api'}, 'rollback_parameter':{'process_name':'nova_api'}, - 'key':'stop_service', + 'key':'stop-service', 'host': 'node1', } diff --git a/tests/unit/benchmark/scenarios/availability/test_basemonitor.py b/tests/unit/benchmark/scenarios/availability/test_basemonitor.py index 140841075..a20cf8187 100644 --- a/tests/unit/benchmark/scenarios/availability/test_basemonitor.py +++ b/tests/unit/benchmark/scenarios/availability/test_basemonitor.py @@ -23,7 +23,7 @@ class MonitorMgrTestCase(unittest.TestCase): def setUp(self): config = { 'monitor_type': 'openstack-api', - 'key' : 'service_status' + 'key' : 'service-status' } self.monitor_configs = [] @@ -40,7 +40,7 @@ class MonitorMgrTestCase(unittest.TestCase): def test_MonitorMgr_getitem(self, mock_monitor): monitorMgr = basemonitor.MonitorMgr() monitorMgr.init_monitors(self.monitor_configs, None) - monitorIns = monitorMgr['service_status'] + monitorIns = monitorMgr['service-status'] class BaseMonitorTestCase(unittest.TestCase): diff --git a/tests/unit/benchmark/scenarios/availability/test_baseoperation.py b/tests/unit/benchmark/scenarios/availability/test_baseoperation.py index 8c341913f..d85f1e19f 100644 --- a/tests/unit/benchmark/scenarios/availability/test_baseoperation.py +++ b/tests/unit/benchmark/scenarios/availability/test_baseoperation.py @@ -22,7 +22,7 @@ class OperationMgrTestCase(unittest.TestCase): def setUp(self): config = { 'operation_type': 'general-operation', - 'key' : 'service_status' + 'key' : 'service-status' } self.operation_configs = [] @@ -31,7 +31,7 @@ class OperationMgrTestCase(unittest.TestCase): def test_all_successful(self, mock_operation): mgr_ins = baseoperation.OperationMgr() mgr_ins.init_operations(self.operation_configs, None) - operation_ins = mgr_ins["service_status"] + operation_ins = mgr_ins["service-status"] mgr_ins.rollback() def test_getitem_fail(self, mock_operation): @@ -59,7 +59,7 @@ class BaseOperationTestCase(unittest.TestCase): def setUp(self): self.config = { 'operation_type': 'general-operation', - 'key' : 'service_status' + 'key' : 'service-status' } def test_all_successful(self): diff --git a/tests/unit/benchmark/scenarios/availability/test_director.py b/tests/unit/benchmark/scenarios/availability/test_director.py index 887ddd631..06116725d 100644 --- a/tests/unit/benchmark/scenarios/availability/test_director.py +++ b/tests/unit/benchmark/scenarios/availability/test_director.py @@ -33,16 +33,16 @@ class DirectorTestCase(unittest.TestCase): 'key': "kill-process"}], 'monitors': [{ 'monitor_type': "general-monitor", - 'key': "service_status"}], + 'key': "service-status"}], 'operations': [{ 'operation_type': 'general-operation', - 'key' : 'service_status'}], + 'key' : 'service-status'}], 'resultCheckers': [{ 'checker_type': 'general-result-checker', 'key' : 'process-checker',}], 'steps':[ { - 'actionKey': "service_status", + 'actionKey': "service-status", 'actionType': "operation", 'index': 1}, { @@ -54,7 +54,7 @@ class DirectorTestCase(unittest.TestCase): 'actionType': "resultchecker", 'index': 3}, { - 'actionKey': "service_status", + 'actionKey': "service-status", 'actionType': "monitor", 'index': 4}, ] @@ -69,12 +69,12 @@ class DirectorTestCase(unittest.TestCase): def test_director_all_successful(self, mock_checer, mock_opertion, mock_attacker, mock_monitor): ins = Director(self.scenario_cfg, self.ctx) - opertion_action = ins.createActionPlayer("operation", "service_status") + opertion_action = ins.createActionPlayer("operation", "service-status") attacker_action = ins.createActionPlayer("attacker", "kill-process") checker_action = ins.createActionPlayer("resultchecker", "process-checker") - monitor_action = ins.createActionPlayer("monitor", "service_status") + monitor_action = ins.createActionPlayer("monitor", "service-status") - opertion_rollback = ins.createActionRollbacker("operation", "service_status") + opertion_rollback = ins.createActionRollbacker("operation", "service-status") attacker_rollback = ins.createActionRollbacker("attacker", "kill-process") ins.executionSteps.append(opertion_rollback) ins.executionSteps.append(attacker_rollback) diff --git a/tests/unit/benchmark/scenarios/availability/test_monitor_general.py b/tests/unit/benchmark/scenarios/availability/test_monitor_general.py index 85487a574..b48434c99 100644 --- a/tests/unit/benchmark/scenarios/availability/test_monitor_general.py +++ b/tests/unit/benchmark/scenarios/availability/test_monitor_general.py @@ -31,18 +31,18 @@ class GeneralMonitorServiceTestCase(unittest.TestCase): self.context = {"node1": host} self.monitor_cfg = { 'monitor_type': 'general-monitor', - 'key': 'service_status', + 'key': 'service-status', 'host': 'node1', 'monitor_time': 3, 'parameter': {'serviceName': 'haproxy'}, - 'sla': {'max_recover_time': 1} + 'sla': {'max_outage_time': 1} } self.monitor_cfg_noparam = { 'monitor_type': 'general-monitor', - 'key': 'service_status', + 'key': 'service-status', 'host': 'node1', 'monitor_time': 3, - 'sla': {'max_recover_time': 1} + 'sla': {'max_outage_time': 1} } def test__monitor_general_all_successful(self, mock_open, mock_ssh): diff --git a/tests/unit/benchmark/scenarios/availability/test_scenario_general.py b/tests/unit/benchmark/scenarios/availability/test_scenario_general.py index c17edea45..bab9d62f1 100644 --- a/tests/unit/benchmark/scenarios/availability/test_scenario_general.py +++ b/tests/unit/benchmark/scenarios/availability/test_scenario_general.py @@ -29,14 +29,14 @@ class ScenarioGeneralTestCase(unittest.TestCase): 'key': "kill-process"}], 'monitors': [{ 'monitor_type': "general-monitor", - 'key': "service_status"}], + 'key': "service-status"}], 'steps':[ { 'actionKey': "kill-process", 'actionType': "attacker", 'index': 1}, { - 'actionKey': "service_status", + 'actionKey': "service-status", 'actionType': "monitor", 'index': 2}] } @@ -62,4 +62,4 @@ class ScenarioGeneralTestCase(unittest.TestCase): mock_obj.verify.return_value = False ins.director = mock_obj ins.run(None) - ins.teardown()
\ No newline at end of file + ins.teardown() diff --git a/tests/unit/benchmark/scenarios/networking/test_sfc.py b/tests/unit/benchmark/scenarios/networking/test_sfc.py index 2d7990e59..618efc32e 100644 --- a/tests/unit/benchmark/scenarios/networking/test_sfc.py +++ b/tests/unit/benchmark/scenarios/networking/test_sfc.py @@ -45,8 +45,22 @@ class SfcTestCase(unittest.TestCase): def test_run_for_success(self, mock_subprocess, mock_openstack, mock_ssh): # Mock a successfull SSH in Sfc.setup() and Sfc.run() mock_ssh.SSH().execute.return_value = (0, '100', '') - mock_openstack.return_value = "127.0.0.1" - mock_subprocess.return_value = 'mocked!' + mock_openstack.get_an_IP.return_value = "127.0.0.1" + mock_subprocess.call.return_value = 'mocked!' + + result = {} + self.sfc.setup() + self.sfc.run(result) + self.sfc.teardown() + + @mock.patch('yardstick.benchmark.scenarios.networking.sfc.ssh') + @mock.patch('yardstick.benchmark.scenarios.networking.sfc.sfc_openstack') + @mock.patch('yardstick.benchmark.scenarios.networking.sfc.subprocess') + def test2_run_for_success(self, mock_subprocess, mock_openstack, mock_ssh): + # Mock a successfull SSH in Sfc.setup() and Sfc.run() + mock_ssh.SSH().execute.return_value = (0, 'vxlan_tool.py', 'succeeded timed out') + mock_openstack.get_an_IP.return_value = "127.0.0.1" + mock_subprocess.call.return_value = 'mocked!' result = {} self.sfc.setup() diff --git a/yardstick/benchmark/scenarios/availability/attacker_conf.yaml b/yardstick/benchmark/scenarios/availability/attacker_conf.yaml index 16b3d735c..e5d1b9f0b 100644 --- a/yardstick/benchmark/scenarios/availability/attacker_conf.yaml +++ b/yardstick/benchmark/scenarios/availability/attacker_conf.yaml @@ -12,6 +12,6 @@ bare-metal-down: check_script: ha_tools/check_host_ping.bash recovery_script: ha_tools/ipmi_power.bash -stop_service: +stop-service: inject_script: ha_tools/stop_service.bash recovery_script: ha_tools/start_service.bash diff --git a/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py b/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py index 515514c29..e7e4d5bce 100644 --- a/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py +++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py @@ -59,7 +59,7 @@ class GeneralMonitor(basemonitor.BaseMonitor): def verify_SLA(self): LOG.debug("the _result:%s" % self._result) outage_time = self._result.get('outage_time', None) - max_outage_time = self._config["sla"]["max_recover_time"] + max_outage_time = self._config["sla"]["max_outage_time"] if outage_time is None: LOG.error("There is no outage_time in monitor result.") return False diff --git a/yardstick/benchmark/scenarios/availability/monitor_conf.yaml b/yardstick/benchmark/scenarios/availability/monitor_conf.yaml index 9efceed88..d7bbdfe60 100644 --- a/yardstick/benchmark/scenarios/availability/monitor_conf.yaml +++ b/yardstick/benchmark/scenarios/availability/monitor_conf.yaml @@ -3,9 +3,9 @@ # schema: "yardstick:task:0.1" -process_status: +process-status: monitor_script: ha_tools/check_process_python.bash -nova_image_list: +nova-image-list: monitor_script: ha_tools/nova_image_list.bash -service_status: +service-status: monitor_script: ha_tools/check_service.bash diff --git a/yardstick/benchmark/scenarios/availability/operation_conf.yaml b/yardstick/benchmark/scenarios/availability/operation_conf.yaml index 78c996d05..1e6746302 100644 --- a/yardstick/benchmark/scenarios/availability/operation_conf.yaml +++ b/yardstick/benchmark/scenarios/availability/operation_conf.yaml @@ -7,10 +7,10 @@ nova-create-instance: action_script: ha_tools/nova/create_instance_from_image.bash rollback_script: ha_tools/nova/delete_instance.bash -swift_upload_file: +swift-upload-file: action_script: ha_tools/swift/upload.bash rollback_script: ha_tools/swift/delete.bash -swift_download_file: +swift-download-file: action_script: ha_tools/swift/download.bash - rollback_script: ha_tools/file/remove_file.bash
\ No newline at end of file + rollback_script: ha_tools/file/remove_file.bash |