aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark/scenarios/availability
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/benchmark/scenarios/availability')
-rw-r--r--tests/unit/benchmark/scenarios/availability/__init__.py0
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_attacker_baremetal.py84
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_attacker_general.py58
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_attacker_process.py55
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_basemonitor.py125
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_baseoperation.py87
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_baseresultchecker.py93
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_director.py104
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_monitor_command.py92
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_monitor_general.py80
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_monitor_multi.py61
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_monitor_process.py59
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_operation_general.py72
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_result_checker_general.py116
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_scenario_general.py71
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_serviceha.py79
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_util.py58
17 files changed, 0 insertions, 1294 deletions
diff --git a/tests/unit/benchmark/scenarios/availability/__init__.py b/tests/unit/benchmark/scenarios/availability/__init__.py
deleted file mode 100644
index e69de29bb..000000000
--- a/tests/unit/benchmark/scenarios/availability/__init__.py
+++ /dev/null
diff --git a/tests/unit/benchmark/scenarios/availability/test_attacker_baremetal.py b/tests/unit/benchmark/scenarios/availability/test_attacker_baremetal.py
deleted file mode 100644
index cc179602e..000000000
--- a/tests/unit/benchmark/scenarios/availability/test_attacker_baremetal.py
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-# Unittest for
-# yardstick.benchmark.scenarios.availability.attacker.attacker_baremetal
-
-from __future__ import absolute_import
-import mock
-import unittest
-
-from yardstick.benchmark.scenarios.availability.attacker import \
- attacker_baremetal
-
-
-@mock.patch('yardstick.benchmark.scenarios.availability.attacker.attacker_baremetal.subprocess')
-class ExecuteShellTestCase(unittest.TestCase):
-
- def test__fun_execute_shell_command_successful(self, mock_subprocess):
- cmd = "env"
- mock_subprocess.check_output.return_value = (0, 'unittest')
- exitcode, output = attacker_baremetal._execute_shell_command(cmd)
- self.assertEqual(exitcode, 0)
-
- @mock.patch('yardstick.benchmark.scenarios.availability.attacker.attacker_baremetal.LOG')
- def test__fun_execute_shell_command_fail_cmd_exception(self, mock_log, mock_subprocess):
- cmd = "env"
- mock_subprocess.check_output.side_effect = RuntimeError
- exitcode, output = attacker_baremetal._execute_shell_command(cmd)
- self.assertEqual(exitcode, -1)
- mock_log.error.assert_called_once()
-
-
-@mock.patch('yardstick.benchmark.scenarios.availability.attacker.attacker_baremetal.subprocess')
-@mock.patch('yardstick.benchmark.scenarios.availability.attacker.attacker_baremetal.ssh')
-class AttackerBaremetalTestCase(unittest.TestCase):
-
- def setUp(self):
- host = {
- "ipmi_ip": "10.20.0.5",
- "ipmi_user": "root",
- "ipmi_pwd": "123456",
- "ip": "10.20.0.5",
- "user": "root",
- "key_filename": "/root/.ssh/id_rsa"
- }
- self.context = {"node1": host}
- self.attacker_cfg = {
- 'fault_type': 'bear-metal-down',
- 'host': 'node1',
- }
-
- def test__attacker_baremetal_all_successful(self, mock_ssh, mock_subprocess):
- mock_ssh.SSH.from_node().execute.return_value = (0, "running", '')
- ins = attacker_baremetal.BaremetalAttacker(self.attacker_cfg,
- self.context)
-
- ins.setup()
- ins.inject_fault()
- ins.recover()
-
- def test__attacker_baremetal_check_failuer(self, mock_ssh, mock_subprocess):
- mock_ssh.SSH.from_node().execute.return_value = (0, "error check", '')
- ins = attacker_baremetal.BaremetalAttacker(self.attacker_cfg,
- self.context)
- ins.setup()
-
- def test__attacker_baremetal_recover_successful(self, mock_ssh, mock_subprocess):
-
- self.attacker_cfg["jump_host"] = 'node1'
- self.context["node1"]["pwd"] = "123456"
- mock_ssh.SSH.from_node().execute.return_value = (0, "running", '')
- ins = attacker_baremetal.BaremetalAttacker(self.attacker_cfg,
- self.context)
-
- ins.setup()
- ins.recover()
diff --git a/tests/unit/benchmark/scenarios/availability/test_attacker_general.py b/tests/unit/benchmark/scenarios/availability/test_attacker_general.py
deleted file mode 100644
index 612b5a662..000000000
--- a/tests/unit/benchmark/scenarios/availability/test_attacker_general.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Copyright (c) 2016 Juan Qiu and others
-# juan_ qiu@tongji.edu.cn
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-# Unittest for yardstick.benchmark.scenarios.availability.attacker
-# .attacker_general
-
-from __future__ import absolute_import
-import mock
-import unittest
-
-from yardstick.benchmark.scenarios.availability.attacker import baseattacker
-
-
-@mock.patch('yardstick.benchmark.scenarios.availability.attacker.'
- 'attacker_general.ssh')
-class GeneralAttackerServiceTestCase(unittest.TestCase):
-
- def setUp(self):
- host = {
- "ip": "10.20.0.5",
- "user": "root",
- "key_filename": "/root/.ssh/id_rsa"
- }
- self.context = {"node1": host}
- self.attacker_cfg = {
- 'fault_type': 'general-attacker',
- 'action_parameter': {'process_name': 'nova_api'},
- 'rollback_parameter': {'process_name': 'nova_api'},
- 'key': 'stop-service',
- 'attack_key': 'stop-service',
- 'host': 'node1',
- }
-
- def test__attacker_service_all_successful(self, mock_ssh):
-
- cls = baseattacker.BaseAttacker.get_attacker_cls(self.attacker_cfg)
- ins = cls(self.attacker_cfg, self.context)
-
- mock_ssh.SSH.from_node().execute.return_value = (0, "running", '')
- ins.setup()
- ins.inject_fault()
- ins.recover()
-
- def test__attacker_service_check_failuer(self, mock_ssh):
-
- cls = baseattacker.BaseAttacker.get_attacker_cls(self.attacker_cfg)
- ins = cls(self.attacker_cfg, self.context)
-
- mock_ssh.SSH.from_node().execute.return_value = (0, "error check", '')
- ins.setup()
diff --git a/tests/unit/benchmark/scenarios/availability/test_attacker_process.py b/tests/unit/benchmark/scenarios/availability/test_attacker_process.py
deleted file mode 100644
index 0a8e8322a..000000000
--- a/tests/unit/benchmark/scenarios/availability/test_attacker_process.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-# Unittest for
-# yardstick.benchmark.scenarios.availability.attacker.attacker_process
-
-from __future__ import absolute_import
-import mock
-import unittest
-
-from yardstick.benchmark.scenarios.availability.attacker import baseattacker
-
-
-@mock.patch(
- 'yardstick.benchmark.scenarios.availability.attacker.attacker_process.ssh')
-class AttackerServiceTestCase(unittest.TestCase):
-
- def setUp(self):
- host = {
- "ip": "10.20.0.5",
- "user": "root",
- "key_filename": "/root/.ssh/id_rsa"
- }
- self.context = {"node1": host}
- self.attacker_cfg = {
- 'fault_type': 'kill-process',
- 'process_name': 'nova-api',
- 'host': 'node1',
- }
-
- def test__attacker_service_all_successful(self, mock_ssh):
-
- cls = baseattacker.BaseAttacker.get_attacker_cls(self.attacker_cfg)
- ins = cls(self.attacker_cfg, self.context)
-
- mock_ssh.SSH.from_node().execute.return_value = (0, "10", '')
- ins.setup()
- ins.inject_fault()
- ins.recover()
-
- def test__attacker_service_check_failuer(self, mock_ssh):
-
- cls = baseattacker.BaseAttacker.get_attacker_cls(self.attacker_cfg)
- ins = cls(self.attacker_cfg, self.context)
-
- mock_ssh.SSH.from_node().execute.return_value = (0, None, '')
- ins.setup()
diff --git a/tests/unit/benchmark/scenarios/availability/test_basemonitor.py b/tests/unit/benchmark/scenarios/availability/test_basemonitor.py
deleted file mode 100644
index 92ae8aa88..000000000
--- a/tests/unit/benchmark/scenarios/availability/test_basemonitor.py
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-# Unittest for
-# yardstick.benchmark.scenarios.availability.monitor.monitor_command
-
-from __future__ import absolute_import
-import mock
-import unittest
-
-from yardstick.benchmark.scenarios.availability.monitor import basemonitor
-
-
-@mock.patch(
- 'yardstick.benchmark.scenarios.availability.monitor.basemonitor'
- '.BaseMonitor')
-class MonitorMgrTestCase(unittest.TestCase):
-
- def setUp(self):
- self.monitor_configs = [
- {
- "monitor_type": "openstack-cmd",
- "command_name": "openstack router list",
- "monitor_time": 10,
- "monitor_number": 3,
- "sla": {
- "max_outage_time": 5
- }
- },
- {
- "monitor_type": "process",
- "process_name": "neutron-server",
- "host": "node1",
- "monitor_time": 20,
- "monitor_number": 3,
- "sla": {
- "max_recover_time": 20
- }
- }
- ]
- self.MonitorMgr = basemonitor.MonitorMgr([])
- self.MonitorMgr.init_monitors(self.monitor_configs, None)
- self.monitor_list = self.MonitorMgr._monitor_list
- for mo in self.monitor_list:
- mo._result = {"outage_time": 10}
-
- def test__MonitorMgr_setup_successful(self, mock_monitor):
- instance = basemonitor.MonitorMgr({"nova-api": 10})
- instance.init_monitors(self.monitor_configs, None)
- instance.start_monitors()
- instance.wait_monitors()
-
- ret = instance.verify_SLA()
-
- def test_MonitorMgr_getitem(self, mock_monitor):
- monitorMgr = basemonitor.MonitorMgr({"nova-api": 10})
- monitorMgr.init_monitors(self.monitor_configs, None)
-
- def test_store_result(self, mock_monitor):
- expect = {'process_neutron-server_outage_time': 10,
- 'openstack-router-list_outage_time': 10}
- result = {}
- self.MonitorMgr.store_result(result)
- self.assertDictEqual(result, expect)
-
-
-class BaseMonitorTestCase(unittest.TestCase):
-
- class MonitorSimple(basemonitor.BaseMonitor):
- __monitor_type__ = "MonitorForTest"
-
- def setup(self):
- self.monitor_result = False
-
- def monitor_func(self):
- return self.monitor_result
-
- def setUp(self):
- self.monitor_cfg = {
- 'monitor_type': 'MonitorForTest',
- 'command_name': 'nova image-list',
- 'monitor_time': 0.01,
- 'sla': {'max_outage_time': 5}
- }
-
- def test__basemonitor_start_wait_successful(self):
- ins = basemonitor.BaseMonitor(self.monitor_cfg, None, {"nova-api": 10})
- ins.start_monitor()
- ins.wait_monitor()
-
- def test__basemonitor_all_successful(self):
- ins = self.MonitorSimple(self.monitor_cfg, None, {"nova-api": 10})
- ins.setup()
- ins.run()
- ins.verify_SLA()
-
- @mock.patch(
- 'yardstick.benchmark.scenarios.availability.monitor.basemonitor'
- '.multiprocessing')
- def test__basemonitor_func_false(self, mock_multiprocess):
- ins = self.MonitorSimple(self.monitor_cfg, None, {"nova-api": 10})
- ins.setup()
- mock_multiprocess.Event().is_set.return_value = False
- ins.run()
- ins.verify_SLA()
-
- def test__basemonitor_getmonitorcls_successfule(self):
- cls = None
- try:
- cls = basemonitor.BaseMonitor.get_monitor_cls(self.monitor_cfg)
- except Exception:
- pass
- self.assertIsNone(cls)
-
-
-if __name__ == "__main__":
- unittest.main()
diff --git a/tests/unit/benchmark/scenarios/availability/test_baseoperation.py b/tests/unit/benchmark/scenarios/availability/test_baseoperation.py
deleted file mode 100644
index 03ec1492b..000000000
--- a/tests/unit/benchmark/scenarios/availability/test_baseoperation.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Copyright (c) 2016 Huan Li and others
-# lihuansse@tongji.edu.cn
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-# Unittest for
-# yardstick.benchmark.scenarios.availability.operation.baseoperation
-
-from __future__ import absolute_import
-import mock
-import unittest
-
-from yardstick.benchmark.scenarios.availability.operation import baseoperation
-
-
-@mock.patch(
- 'yardstick.benchmark.scenarios.availability.operation.baseoperation'
- '.BaseOperation')
-class OperationMgrTestCase(unittest.TestCase):
-
- def setUp(self):
- config = {
- 'operation_type': 'general-operation',
- 'key': 'service-status'
- }
-
- self.operation_configs = []
- self.operation_configs.append(config)
-
- 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"]
- mgr_ins.rollback()
-
- def test_getitem_fail(self, mock_operation):
- mgr_ins = baseoperation.OperationMgr()
- mgr_ins.init_operations(self.operation_configs, None)
- with self.assertRaises(KeyError):
- operation_ins = mgr_ins["operation-not-exist"]
-
-
-class TestOperation(baseoperation.BaseOperation):
- __operation__type__ = "test-operation"
-
- def setup(self):
- pass
-
- def run(self):
- pass
-
- def rollback(self):
- pass
-
-
-class BaseOperationTestCase(unittest.TestCase):
-
- def setUp(self):
- self.config = {
- 'operation_type': 'general-operation',
- 'key': 'service-status'
- }
-
- def test_all_successful(self):
- base_ins = baseoperation.BaseOperation(self.config, None)
- base_ins.setup()
- base_ins.run()
- base_ins.rollback()
-
- def test_get_script_fullpath(self):
- base_ins = baseoperation.BaseOperation(self.config, None)
- base_ins.get_script_fullpath("ha_tools/test.bash")
-
- def test_get_operation_cls_successful(self):
- base_ins = baseoperation.BaseOperation(self.config, None)
- operation_ins = base_ins.get_operation_cls("test-operation")
-
- def test_get_operation_cls_fail(self):
- base_ins = baseoperation.BaseOperation(self.config, None)
- with self.assertRaises(RuntimeError):
- operation_ins = base_ins.get_operation_cls("operation-not-exist")
diff --git a/tests/unit/benchmark/scenarios/availability/test_baseresultchecker.py b/tests/unit/benchmark/scenarios/availability/test_baseresultchecker.py
deleted file mode 100644
index 36ce900fb..000000000
--- a/tests/unit/benchmark/scenarios/availability/test_baseresultchecker.py
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Copyright (c) 2016 Huan Li and others
-# lihuansse@tongji.edu.cn
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-# Unittest for yardstick.benchmark.scenarios.availability.result_checker
-# .baseresultchecker
-
-from __future__ import absolute_import
-import mock
-import unittest
-
-from yardstick.benchmark.scenarios.availability.result_checker import \
- baseresultchecker
-
-
-@mock.patch('yardstick.benchmark.scenarios.availability.result_checker'
- '.baseresultchecker.BaseResultChecker')
-class ResultCheckerMgrTestCase(unittest.TestCase):
-
- def setUp(self):
- config = {
- 'checker_type': 'general-result-checker',
- 'key': 'process-checker'
- }
-
- self.checker_configs = []
- self.checker_configs.append(config)
-
- def test_ResultCheckerMgr_setup_successful(self, mock_basechacer):
- mgr_ins = baseresultchecker.ResultCheckerMgr()
- mgr_ins.init_ResultChecker(self.checker_configs, None)
- mgr_ins.verify()
-
- def test_getitem_succeessful(self, mock_basechacer):
- mgr_ins = baseresultchecker.ResultCheckerMgr()
- mgr_ins.init_ResultChecker(self.checker_configs, None)
- checker_ins = mgr_ins["process-checker"]
-
- def test_getitem_fail(self, mock_basechacer):
- mgr_ins = baseresultchecker.ResultCheckerMgr()
- mgr_ins.init_ResultChecker(self.checker_configs, None)
- with self.assertRaises(KeyError):
- checker_ins = mgr_ins["checker-not-exist"]
-
-
-class BaseResultCheckerTestCase(unittest.TestCase):
-
- class ResultCheckeSimple(baseresultchecker.BaseResultChecker):
- __result_checker__type__ = "ResultCheckeForTest"
-
- def setup(self):
- self.success = False
-
- def verify(self):
- return self.success
-
- def setUp(self):
- self.checker_cfg = {
- 'checker_type': 'general-result-checker',
- 'key': 'process-checker'
- }
-
- def test_baseresultchecker_setup_verify_successful(self):
- ins = baseresultchecker.BaseResultChecker(self.checker_cfg, None)
- ins.setup()
- ins.verify()
-
- def test_baseresultchecker_verfiy_pass(self):
- ins = baseresultchecker.BaseResultChecker(self.checker_cfg, None)
- ins.setup()
- ins.actualResult = True
- ins.expectedResult = True
- ins.verify()
-
- def test_get_script_fullpath(self):
- ins = baseresultchecker.BaseResultChecker(self.checker_cfg, None)
- path = ins.get_script_fullpath("test.bash")
-
- def test_get_resultchecker_cls_successful(self):
- baseresultchecker.BaseResultChecker.get_resultchecker_cls(
- "ResultCheckeForTest")
-
- def test_get_resultchecker_cls_fail(self):
- with self.assertRaises(RuntimeError):
- baseresultchecker.BaseResultChecker.get_resultchecker_cls(
- "ResultCheckeNotExist")
diff --git a/tests/unit/benchmark/scenarios/availability/test_director.py b/tests/unit/benchmark/scenarios/availability/test_director.py
deleted file mode 100644
index d01a60e2d..000000000
--- a/tests/unit/benchmark/scenarios/availability/test_director.py
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Copyright (c) 2016 Huan Li and others
-# lihuansse@tongji.edu.cn
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-# Unittest for yardstick.benchmark.scenarios.availability.director
-
-from __future__ import absolute_import
-import mock
-import unittest
-
-from yardstick.benchmark.scenarios.availability.director import Director
-
-
-@mock.patch('yardstick.benchmark.scenarios.availability.director.basemonitor')
-@mock.patch('yardstick.benchmark.scenarios.availability.director.baseattacker')
-@mock.patch(
- 'yardstick.benchmark.scenarios.availability.director.baseoperation')
-@mock.patch(
- 'yardstick.benchmark.scenarios.availability.director.baseresultchecker')
-class DirectorTestCase(unittest.TestCase):
-
- def setUp(self):
- self.scenario_cfg = {
- 'type': "general_scenario",
- 'options': {
- 'attackers': [{
- 'fault_type': "general-attacker",
- 'key': "kill-process"}],
- 'monitors': [{
- 'monitor_type': "general-monitor",
- 'key': "service-status"}],
- 'operations': [{
- 'operation_type': 'general-operation',
- 'key': 'service-status'}],
- 'resultCheckers': [{
- 'checker_type': 'general-result-checker',
- 'key': 'process-checker', }],
- 'steps': [
- {
- 'actionKey': "service-status",
- 'actionType': "operation",
- 'index': 1},
- {
- 'actionKey': "kill-process",
- 'actionType': "attacker",
- 'index': 2},
- {
- 'actionKey': "process-checker",
- 'actionType': "resultchecker",
- 'index': 3},
- {
- 'actionKey': "service-status",
- 'actionType': "monitor",
- 'index': 4},
- ]
- }
- }
- host = {
- "ip": "10.20.0.5",
- "user": "root",
- "key_filename": "/root/.ssh/id_rsa"
- }
- self.ctx = {"nodes": {"node1": host}}
-
- 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")
- attacker_action = ins.createActionPlayer("attacker", "kill-process")
- checker_action = ins.createActionPlayer("resultchecker",
- "process-checker")
- monitor_action = ins.createActionPlayer("monitor", "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)
-
- opertion_action.action()
- attacker_action.action()
- checker_action.action()
- monitor_action.action()
-
- attacker_rollback.rollback()
- opertion_rollback.rollback()
-
- ins.stopMonitors()
- ins.verify()
- ins.knockoff()
-
- def test_director_get_wrong_item(self, mock_checer, mock_opertion,
- mock_attacker, mock_monitor):
- ins = Director(self.scenario_cfg, self.ctx)
- ins.createActionPlayer("wrong_type", "wrong_key")
- ins.createActionRollbacker("wrong_type", "wrong_key")
diff --git a/tests/unit/benchmark/scenarios/availability/test_monitor_command.py b/tests/unit/benchmark/scenarios/availability/test_monitor_command.py
deleted file mode 100644
index b84cef23c..000000000
--- a/tests/unit/benchmark/scenarios/availability/test_monitor_command.py
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-# Unittest for
-# yardstick.benchmark.scenarios.availability.monitor.monitor_command
-
-from __future__ import absolute_import
-import mock
-import unittest
-
-from yardstick.benchmark.scenarios.availability.monitor import monitor_command
-
-
-@mock.patch('subprocess.check_output')
-class ExecuteShellTestCase(unittest.TestCase):
-
- def test__fun_execute_shell_command_successful(self, mock_subprocess_check_output):
- cmd = "env"
- mock_subprocess_check_output.return_value = (0, 'unittest')
- exitcode, _ = monitor_command._execute_shell_command(cmd)
- self.assertEqual(exitcode, 0)
-
- @mock.patch('yardstick.benchmark.scenarios.availability.monitor.monitor_command.LOG')
- def test__fun_execute_shell_command_fail_cmd_exception(self, mock_log,
- mock_subprocess_check_output):
- cmd = "env"
- mock_subprocess_check_output.side_effect = RuntimeError
- exitcode, _ = monitor_command._execute_shell_command(cmd)
- self.assertEqual(exitcode, -1)
- mock_log.error.assert_called_once()
-
-
-@mock.patch('subprocess.check_output')
-class MonitorOpenstackCmdTestCase(unittest.TestCase):
-
- def setUp(self):
- host = {
- "ip": "10.20.0.5",
- "user": "root",
- "key_filename": "/root/.ssh/id_rsa"
- }
- self.context = {"node1": host}
- self.config = {
- 'monitor_type': 'openstack-api',
- 'command_name': 'nova image-list',
- 'monitor_time': 1,
- 'sla': {'max_outage_time': 5}
- }
-
- def test__monitor_command_monitor_func_successful(self, mock_subprocess_check_output):
-
- instance = monitor_command.MonitorOpenstackCmd(self.config, None, {"nova-api": 10})
- instance.setup()
- mock_subprocess_check_output.return_value = (0, 'unittest')
- ret = instance.monitor_func()
- self.assertTrue(ret)
- instance._result = {"outage_time": 0}
- instance.verify_SLA()
-
- @mock.patch('yardstick.benchmark.scenarios.availability.monitor.monitor_command.LOG')
- def test__monitor_command_monitor_func_failure(self, mock_log, mock_subprocess_check_output):
- mock_subprocess_check_output.return_value = (1, 'unittest')
- instance = monitor_command.MonitorOpenstackCmd(self.config, None, {"nova-api": 10})
- instance.setup()
- mock_subprocess_check_output.side_effect = RuntimeError
- ret = instance.monitor_func()
- self.assertFalse(ret)
- mock_log.error.assert_called_once()
- instance._result = {"outage_time": 10}
- instance.verify_SLA()
-
- @mock.patch(
- 'yardstick.benchmark.scenarios.availability.monitor.monitor_command'
- '.ssh')
- def test__monitor_command_ssh_monitor_successful(self, mock_ssh, mock_subprocess_check_output):
-
- mock_subprocess_check_output.return_value = (0, 'unittest')
- self.config["host"] = "node1"
- instance = monitor_command.MonitorOpenstackCmd(
- self.config, self.context, {"nova-api": 10})
- instance.setup()
- mock_ssh.SSH.from_node().execute.return_value = (0, "0", '')
- ret = instance.monitor_func()
- self.assertTrue(ret)
diff --git a/tests/unit/benchmark/scenarios/availability/test_monitor_general.py b/tests/unit/benchmark/scenarios/availability/test_monitor_general.py
deleted file mode 100644
index c14f073ec..000000000
--- a/tests/unit/benchmark/scenarios/availability/test_monitor_general.py
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Copyright (c) 2016 Huan Li and others
-# lihuansse@tongji.edu.cn
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-# Unittest for yardstick.benchmark.scenarios.availability.monitor
-# .monitor_general
-
-from __future__ import absolute_import
-import mock
-import unittest
-from yardstick.benchmark.scenarios.availability.monitor import monitor_general
-
-
-@mock.patch('yardstick.benchmark.scenarios.availability.monitor.'
- 'monitor_general.ssh')
-@mock.patch('yardstick.benchmark.scenarios.availability.monitor.'
- 'monitor_general.open')
-class GeneralMonitorServiceTestCase(unittest.TestCase):
-
- def setUp(self):
- host = {
- "ip": "10.20.0.5",
- "user": "root",
- "key_filename": "/root/.ssh/id_rsa"
- }
- self.context = {"node1": host}
- self.monitor_cfg = {
- 'monitor_type': 'general-monitor',
- 'key': 'service-status',
- 'monitor_key': 'service-status',
- 'host': 'node1',
- 'monitor_time': 3,
- 'parameter': {'serviceName': 'haproxy'},
- 'sla': {'max_outage_time': 1}
- }
- self.monitor_cfg_noparam = {
- 'monitor_type': 'general-monitor',
- 'key': 'service-status',
- 'monitor_key': 'service-status',
- 'host': 'node1',
- 'monitor_time': 3,
- 'sla': {'max_outage_time': 1}
- }
-
- def test__monitor_general_all_successful(self, mock_open, mock_ssh):
- ins = monitor_general.GeneralMonitor(self.monitor_cfg, self.context, {"nova-api": 10})
-
- ins.setup()
- mock_ssh.SSH.from_node().execute.return_value = (0, "running", '')
- ins.monitor_func()
- ins._result = {'outage_time': 0}
- ins.verify_SLA()
-
- def test__monitor_general_all_successful_noparam(self, mock_open,
- mock_ssh):
- ins = monitor_general.GeneralMonitor(
- self.monitor_cfg_noparam, self.context, {"nova-api": 10})
-
- ins.setup()
- mock_ssh.SSH.from_node().execute.return_value = (0, "running", '')
- ins.monitor_func()
- ins._result = {'outage_time': 0}
- ins.verify_SLA()
-
- def test__monitor_general_failure(self, mock_open, mock_ssh):
- ins = monitor_general.GeneralMonitor(
- self.monitor_cfg_noparam, self.context, {"nova-api": 10})
-
- ins.setup()
- mock_ssh.SSH.from_node().execute.return_value = (1, "error", 'error')
- ins.monitor_func()
- ins._result = {'outage_time': 2}
- ins.verify_SLA()
diff --git a/tests/unit/benchmark/scenarios/availability/test_monitor_multi.py b/tests/unit/benchmark/scenarios/availability/test_monitor_multi.py
deleted file mode 100644
index b59ec6cf1..000000000
--- a/tests/unit/benchmark/scenarios/availability/test_monitor_multi.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Copyright (c) 2016 Huan Li and others
-# lihuansse@tongji.edu.cn
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-# Unittest for yardstick.benchmark.scenarios.availability.monitor
-# .monitor_multi
-
-from __future__ import absolute_import
-import mock
-import unittest
-from yardstick.benchmark.scenarios.availability.monitor import monitor_multi
-
-@mock.patch('yardstick.benchmark.scenarios.availability.monitor.'
- 'monitor_general.ssh')
-@mock.patch('yardstick.benchmark.scenarios.availability.monitor.'
- 'monitor_general.open')
-class MultiMonitorServiceTestCase(unittest.TestCase):
-
- def setUp(self):
- host = {
- "ip": "10.20.0.5",
- "user": "root",
- "key_filename": "/root/.ssh/id_rsa"
- }
- self.context = {"node1": host}
- self.monitor_cfg = {
- 'monitor_type': 'general-monitor',
- 'monitor_number': 3,
- 'key': 'service-status',
- 'monitor_key': 'service-status',
- 'host': 'node1',
- 'monitor_time': 0.1,
- 'parameter': {'serviceName': 'haproxy'},
- 'sla': {'max_outage_time': 1}
- }
-
- def test__monitor_multi_all_successful(self, mock_open, mock_ssh):
- ins = monitor_multi.MultiMonitor(self.monitor_cfg, self.context, {"nova-api": 10})
-
- mock_ssh.SSH.from_node().execute.return_value = (0, "running", '')
-
- ins.start_monitor()
- ins.wait_monitor()
- ins.verify_SLA()
-
- def test__monitor_multi_all_fail(self, mock_open, mock_ssh):
- ins = monitor_multi.MultiMonitor(self.monitor_cfg, self.context, {"nova-api": 10})
-
- mock_ssh.SSH.from_node().execute.return_value = (0, "running", '')
-
- ins.start_monitor()
- ins.wait_monitor()
- ins.verify_SLA()
-
diff --git a/tests/unit/benchmark/scenarios/availability/test_monitor_process.py b/tests/unit/benchmark/scenarios/availability/test_monitor_process.py
deleted file mode 100644
index 41ce5445e..000000000
--- a/tests/unit/benchmark/scenarios/availability/test_monitor_process.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-# Unittest for
-# yardstick.benchmark.scenarios.availability.monitor.monitor_process
-
-from __future__ import absolute_import
-import mock
-import unittest
-
-from yardstick.benchmark.scenarios.availability.monitor import monitor_process
-
-
-@mock.patch(
- 'yardstick.benchmark.scenarios.availability.monitor.monitor_process.ssh')
-class MonitorProcessTestCase(unittest.TestCase):
-
- def setUp(self):
- host = {
- "ip": "10.20.0.5",
- "user": "root",
- "key_filename": "/root/.ssh/id_rsa"
- }
- self.context = {"node1": host}
- self.monitor_cfg = {
- 'monitor_type': 'process',
- 'process_name': 'nova-api',
- 'host': "node1",
- 'monitor_time': 1,
- 'sla': {'max_recover_time': 5}
- }
-
- 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()
-
- def test__monitor_process_down_failuer(self, mock_ssh):
-
- ins = monitor_process.MonitorProcess(self.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}
- ins.verify_SLA()
diff --git a/tests/unit/benchmark/scenarios/availability/test_operation_general.py b/tests/unit/benchmark/scenarios/availability/test_operation_general.py
deleted file mode 100644
index fb8ccb122..000000000
--- a/tests/unit/benchmark/scenarios/availability/test_operation_general.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Copyright (c) 2016 Huan Li and others
-# lihuansse@tongji.edu.cn
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-# Unittest for yardstick.benchmark.scenarios.availability.operation
-# .operation_general
-
-from __future__ import absolute_import
-import mock
-import unittest
-from yardstick.benchmark.scenarios.availability.operation import \
- operation_general
-
-
-@mock.patch('yardstick.benchmark.scenarios.availability.operation.'
- 'operation_general.ssh')
-@mock.patch('yardstick.benchmark.scenarios.availability.operation.'
- 'operation_general.open')
-class GeneralOperaionTestCase(unittest.TestCase):
-
- def setUp(self):
- host = {
- "ip": "10.20.0.5",
- "user": "root",
- "key_filename": "/root/.ssh/id_rsa"
- }
- self.context = {"node1": host}
- self.operation_cfg = {
- 'operation_type': 'general-operation',
- 'action_parameter': {'ins_cup': 2},
- 'rollback_parameter': {'ins_id': 'id123456'},
- 'key': 'nova-create-instance',
- 'operation_key': 'nova-create-instance',
- 'host': 'node1',
- }
- self.operation_cfg_noparam = {
- 'operation_type': 'general-operation',
- 'key': 'nova-create-instance',
- 'operation_key': 'nova-create-instance',
- 'host': 'node1',
- }
-
- def test__operation_successful(self, mock_open, mock_ssh):
- ins = operation_general.GeneralOperaion(self.operation_cfg,
- self.context)
- mock_ssh.SSH.from_node().execute.return_value = (0, "success", '')
- ins.setup()
- ins.run()
- ins.rollback()
-
- def test__operation_successful_noparam(self, mock_open, mock_ssh):
- ins = operation_general.GeneralOperaion(self.operation_cfg_noparam,
- self.context)
- mock_ssh.SSH.from_node().execute.return_value = (0, "success", '')
- ins.setup()
- ins.run()
- ins.rollback()
-
- def test__operation_fail(self, mock_open, mock_ssh):
- ins = operation_general.GeneralOperaion(self.operation_cfg,
- self.context)
- mock_ssh.SSH.from_node().execute.return_value = (1, "failed", '')
- ins.setup()
- ins.run()
- ins.rollback()
diff --git a/tests/unit/benchmark/scenarios/availability/test_result_checker_general.py b/tests/unit/benchmark/scenarios/availability/test_result_checker_general.py
deleted file mode 100644
index d036bb0da..000000000
--- a/tests/unit/benchmark/scenarios/availability/test_result_checker_general.py
+++ /dev/null
@@ -1,116 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Copyright (c) 2016 Huan Li and others
-# lihuansse@tongji.edu.cn
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-# Unittest for yardstick.benchmark.scenarios.availability.result_checker
-# .result_checker_general
-
-from __future__ import absolute_import
-import mock
-import unittest
-import copy
-
-from yardstick.benchmark.scenarios.availability.result_checker import \
- result_checker_general
-
-
-@mock.patch('yardstick.benchmark.scenarios.availability.result_checker.'
- 'result_checker_general.ssh')
-@mock.patch('yardstick.benchmark.scenarios.availability.result_checker.'
- 'result_checker_general.open')
-class GeneralResultCheckerTestCase(unittest.TestCase):
-
- def setUp(self):
- host = {
- "ip": "10.20.0.5",
- "user": "root",
- "key_filename": "/root/.ssh/id_rsa"
- }
- self.context = {"node1": host}
- self.checker_cfg = {
- 'parameter': {'processname': 'process'},
- 'checker_type': 'general-result-checker',
- 'condition': 'eq',
- 'expectedValue': 1,
- 'key': 'process-checker',
- 'checker_key': 'process-checker',
- 'host': 'node1'
- }
-
- def test__result_checker_eq(self, mock_open, mock_ssh):
- ins = result_checker_general.GeneralResultChecker(self.checker_cfg,
- self.context)
- mock_ssh.SSH.from_node().execute.return_value = (0, "1", '')
- ins.setup()
- self.assertTrue(ins.verify())
-
- def test__result_checker_gt(self, mock_open, mock_ssh):
- config = copy.deepcopy(self.checker_cfg)
- config['condition'] = 'gt'
- ins = result_checker_general.GeneralResultChecker(config,
- self.context)
- mock_ssh.SSH.from_node().execute.return_value = (0, "2", '')
- ins.setup()
- self.assertTrue(ins.verify())
-
- def test__result_checker_gt_eq(self, mock_open, mock_ssh):
- config = copy.deepcopy(self.checker_cfg)
- config['condition'] = 'gt_eq'
- ins = result_checker_general.GeneralResultChecker(config,
- self.context)
- mock_ssh.SSH.from_node().execute.return_value = (0, "1", '')
- ins.setup()
- self.assertTrue(ins.verify())
-
- def test__result_checker_lt(self, mock_open, mock_ssh):
- config = copy.deepcopy(self.checker_cfg)
- config['condition'] = 'lt'
- ins = result_checker_general.GeneralResultChecker(config,
- self.context)
- mock_ssh.SSH.from_node().execute.return_value = (0, "0", '')
- ins.setup()
- self.assertTrue(ins.verify())
-
- def test__result_checker_lt_eq(self, mock_open, mock_ssh):
- config = copy.deepcopy(self.checker_cfg)
- config['condition'] = 'lt_eq'
- ins = result_checker_general.GeneralResultChecker(config,
- self.context)
- mock_ssh.SSH.from_node().execute.return_value = (0, "1", '')
- ins.setup()
- self.assertTrue(ins.verify())
-
- def test__result_checker_in(self, mock_open, mock_ssh):
- config = copy.deepcopy(self.checker_cfg)
- config['condition'] = 'in'
- config['expectedValue'] = "value"
- ins = result_checker_general.GeneralResultChecker(config,
- self.context)
- mock_ssh.SSH.from_node().execute.return_value = (0, "value return", '')
- ins.setup()
- self.assertTrue(ins.verify())
-
- def test__result_checker_wrong(self, mock_open, mock_ssh):
- config = copy.deepcopy(self.checker_cfg)
- config['condition'] = 'wrong'
- ins = result_checker_general.GeneralResultChecker(config,
- self.context)
- mock_ssh.SSH.from_node().execute.return_value = (0, "1", '')
- ins.setup()
- self.assertFalse(ins.verify())
-
- def test__result_checker_fail(self, mock_open, mock_ssh):
- config = copy.deepcopy(self.checker_cfg)
- config.pop('parameter')
- ins = result_checker_general.GeneralResultChecker(config,
- self.context)
- mock_ssh.SSH.from_node().execute.return_value = (1, "fail", '')
- ins.setup()
- ins.verify()
diff --git a/tests/unit/benchmark/scenarios/availability/test_scenario_general.py b/tests/unit/benchmark/scenarios/availability/test_scenario_general.py
deleted file mode 100644
index 244a5e798..000000000
--- a/tests/unit/benchmark/scenarios/availability/test_scenario_general.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Copyright (c) 2016 Huan Li and others
-# lihuansse@tongji.edu.cn
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-# Unittest for yardstick.benchmark.scenarios.availability.scenario_general
-
-from __future__ import absolute_import
-import mock
-import unittest
-
-from yardstick.benchmark.scenarios.availability.scenario_general import \
- ScenarioGeneral
-
-
-@mock.patch(
- 'yardstick.benchmark.scenarios.availability.scenario_general.Director')
-class ScenarioGeneralTestCase(unittest.TestCase):
-
- def setUp(self):
- self.scenario_cfg = {
- 'type': "general_scenario",
- 'options': {
- 'attackers': [{
- 'fault_type': "general-attacker",
- 'key': "kill-process"}],
- 'monitors': [{
- 'monitor_type': "general-monitor",
- 'key': "service-status"}],
- 'steps': [
- {
- 'actionKey': "kill-process",
- 'actionType': "attacker",
- 'index': 1},
- {
- 'actionKey': "service-status",
- 'actionType': "monitor",
- 'index': 2}]
- }
- }
-
- def test_scenario_general_all_successful(self, mock_director):
- ins = ScenarioGeneral(self.scenario_cfg, None)
- ins.setup()
- ins.run({})
- ins.teardown()
-
- def test_scenario_general_exception(self, mock_director):
- ins = ScenarioGeneral(self.scenario_cfg, None)
- mock_obj = mock.Mock()
- mock_obj.createActionPlayer.side_effect = KeyError('Wrong')
- ins.director = mock_obj
- ins.director.data = {}
- ins.run({})
- ins.teardown()
-
- def test_scenario_general_case_fail(self, mock_director):
- ins = ScenarioGeneral(self.scenario_cfg, None)
- mock_obj = mock.Mock()
- mock_obj.verify.return_value = False
- ins.director = mock_obj
- ins.director.data = {}
- ins.run({})
- ins.pass_flag = True
- ins.teardown()
diff --git a/tests/unit/benchmark/scenarios/availability/test_serviceha.py b/tests/unit/benchmark/scenarios/availability/test_serviceha.py
deleted file mode 100644
index 97d534894..000000000
--- a/tests/unit/benchmark/scenarios/availability/test_serviceha.py
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-# Unittest for yardstick.benchmark.scenarios.availability.serviceha
-
-from __future__ import absolute_import
-import mock
-import unittest
-
-from yardstick.benchmark.scenarios.availability import serviceha
-
-
-class ServicehaTestCase(unittest.TestCase):
-
- def setUp(self):
- host = {
- "ip": "10.20.0.5",
- "user": "root",
- "key_filename": "/root/.ssh/id_rsa"
- }
- self.ctx = {"nodes": {"node1": host}}
- attacker_cfg = {
- "fault_type": "kill-process",
- "process_name": "nova-api",
- "host": "node1"
- }
- attacker_cfgs = []
- attacker_cfgs.append(attacker_cfg)
- monitor_cfg = {
- "monitor_cmd": "nova image-list",
- "monitor_time": 0.1
- }
- monitor_cfgs = []
- monitor_cfgs.append(monitor_cfg)
-
- options = {
- "attackers": attacker_cfgs,
- "monitors": monitor_cfgs
- }
- sla = {"outage_time": 5}
- self.args = {"options": options, "sla": sla}
-
- @mock.patch('yardstick.benchmark.scenarios.availability.serviceha.basemonitor')
- @mock.patch(
- 'yardstick.benchmark.scenarios.availability.serviceha.baseattacker')
- def test__serviceha_setup_run_successful(self, _,
- mock_monitor):
- p = serviceha.ServiceHA(self.args, self.ctx)
-
- p.setup()
- self.assertTrue(p.setup_done)
- mock_monitor.MonitorMgr().verify_SLA.return_value = True
- ret = {}
- p.run(ret)
- p.teardown()
-
- p.setup()
- self.assertTrue(p.setup_done)
-
-# def test__serviceha_run_sla_error(self, mock_attacker, mock_monitor):
-# p = serviceha.ServiceHA(self.args, self.ctx)
-
-# p.setup()
-# self.assertTrue(p.setup_done)
-#
-# result = {}
-# result["outage_time"] = 10
-# mock_monitor.Monitor().get_result.return_value = result
-
-# ret = {}
-# self.assertRaises(AssertionError, p.run, ret)
diff --git a/tests/unit/benchmark/scenarios/availability/test_util.py b/tests/unit/benchmark/scenarios/availability/test_util.py
deleted file mode 100644
index 548efe91b..000000000
--- a/tests/unit/benchmark/scenarios/availability/test_util.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Copyright (c) 2016 Kanglin Yin and others
-# 14_ykl@tongji.edu.cn
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-# Unittest for yardstick.benchmark.scenarios.availability.utils
-
-import mock
-import unittest
-
-from yardstick.benchmark.scenarios.availability import util
-
-
-class ExecuteShellTestCase(unittest.TestCase):
-
- def setUp(self):
- self.param_config = {'serviceName': '@serviceName', 'value': 1}
- self.intermediate_variables = {'@serviceName': 'nova-api'}
- self.std_output = '| id | 1 |'
- self.cmd_config = {'cmd': 'ls', 'param': '-a'}
-
- self._mock_subprocess = mock.patch.object(util, 'subprocess')
- self.mock_subprocess = self._mock_subprocess.start()
- self.addCleanup(self._stop_mock)
-
- def _stop_mock(self):
- self._mock_subprocess.stop()
-
- def test_util_build_command_shell(self):
- result = util.build_shell_command(self.param_config, True,
- self.intermediate_variables)
- self.assertIn("nova-api", result)
-
- def test_read_stdout_item(self):
- result = util.read_stdout_item(self.std_output, 'id')
- self.assertEqual('1', result)
-
- def test_buildshellparams(self):
- result = util.buildshellparams(self.cmd_config, True)
- self.assertEqual('/bin/bash -s {0} {1}', result)
-
- def test__fun_execute_shell_command_successful(self):
- cmd = "env"
- self.mock_subprocess.check_output.return_value = (0, 'unittest')
- exitcode, _ = util.execute_shell_command(cmd)
- self.assertEqual(exitcode, 0)
-
- def test__fun_execute_shell_command_fail_cmd_exception(self):
- cmd = "env"
- self.mock_subprocess.check_output.side_effect = RuntimeError
- exitcode, _ = util.execute_shell_command(cmd)
- self.assertEqual(exitcode, -1)