summaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark/scenarios/lib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/benchmark/scenarios/lib')
-rw-r--r--tests/unit/benchmark/scenarios/lib/__init__.py0
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_add_memory_load.py65
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_attach_volume.py33
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_check_connectivity.py84
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_check_numa_info.py85
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_check_value.py46
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_create_flavor.py37
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_create_floating_ip.py34
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_create_image.py41
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_create_keypair.py36
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_create_network.py39
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_create_port.py36
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_create_router.py39
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_create_sec_group.py39
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_create_server.py42
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_create_subnet.py41
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_create_volume.py91
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_delete_flavor.py35
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_delete_floating_ip.py36
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_delete_image.py36
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_delete_keypair.py36
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_delete_network.py36
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_delete_port.py34
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_delete_router.py36
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_delete_router_gateway.py36
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_delete_router_interface.py37
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_delete_server.py35
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_delete_volume.py36
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_detach_volume.py35
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_get_flavor.py33
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_get_migrate_target_host.py51
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_get_numa_info.py106
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_get_server.py50
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_get_server_ip.py41
34 files changed, 0 insertions, 1497 deletions
diff --git a/tests/unit/benchmark/scenarios/lib/__init__.py b/tests/unit/benchmark/scenarios/lib/__init__.py
deleted file mode 100644
index e69de29bb..000000000
--- a/tests/unit/benchmark/scenarios/lib/__init__.py
+++ /dev/null
diff --git a/tests/unit/benchmark/scenarios/lib/test_add_memory_load.py b/tests/unit/benchmark/scenarios/lib/test_add_memory_load.py
deleted file mode 100644
index bda07f723..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_add_memory_load.py
+++ /dev/null
@@ -1,65 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-
-from yardstick.benchmark.scenarios.lib.add_memory_load import AddMemoryLoad
-
-
-class AddMemoryLoadTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.ssh.SSH.from_node')
- def test_add_memory_load_with_load(self, mock_from_node):
- scenario_cfg = {
- 'options': {
- 'memory_load': 0.5
- }
- }
- context_cfg = {
- 'host': {}
- }
- mock_from_node().execute.return_value = (0, '0 2048 512', '')
- obj = AddMemoryLoad(scenario_cfg, context_cfg)
- obj.run({})
- self.assertTrue(mock_from_node.called)
-
- @mock.patch('yardstick.ssh.SSH.from_node')
- def test_add_memory_load_without_load(self, mock_from_node):
- scenario_cfg = {
- 'options': {
- 'memory_load': 0
- }
- }
- context_cfg = {
- 'host': {}
- }
- obj = AddMemoryLoad(scenario_cfg, context_cfg)
- obj.run({})
- self.assertTrue(mock_from_node.called)
-
- @mock.patch('yardstick.ssh.SSH.from_node')
- def test_add_memory_load_without_args(self, mock_from_node):
- scenario_cfg = {
- 'options': {
- }
- }
- context_cfg = {
- 'host': {}
- }
- obj = AddMemoryLoad(scenario_cfg, context_cfg)
- obj.run({})
- self.assertTrue(mock_from_node.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_attach_volume.py b/tests/unit/benchmark/scenarios/lib/test_attach_volume.py
deleted file mode 100644
index e69924072..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_attach_volume.py
+++ /dev/null
@@ -1,33 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-
-from yardstick.benchmark.scenarios.lib.attach_volume import AttachVolume
-
-
-class AttachVolumeTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.attach_server_volume')
- def test_attach_volume(self, mock_attach_server_volume):
- options = {
- 'volume_id': '123-456-000',
- 'server_id': '000-123-456'
- }
- args = {"options": options}
- obj = AttachVolume(args, {})
- obj.run({})
- self.assertTrue(mock_attach_server_volume.called)
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_check_connectivity.py b/tests/unit/benchmark/scenarios/lib/test_check_connectivity.py
deleted file mode 100644
index 1fb2f89ca..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_check_connectivity.py
+++ /dev/null
@@ -1,84 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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.lib.check_connectivity.CheckConnectivity
-
-from __future__ import absolute_import
-
-import mock
-import unittest
-
-from yardstick.benchmark.scenarios.lib import check_connectivity
-
-
-class CheckConnectivityTestCase(unittest.TestCase):
-
- def setUp(self):
- self.ctx = {
- 'host': {
- 'ip': '172.16.0.137',
- 'user': 'root',
- 'key_filename': 'mykey.key',
- 'ssh_port': '22'
- },
- 'target': {
- 'ipaddr': '172.16.0.138'
- }
- }
-
- @mock.patch('yardstick.benchmark.scenarios.lib.check_connectivity.ssh')
- def test_check_connectivity(self, mock_ssh):
-
- args = {
- 'options': {'src_ip_addr': '192.168.23.2',
- 'dest_ip_addr': '192.168.23.10',
- 'ssh_user': 'root',
- 'ssh_passwd': 'root',
- 'ssh_port': '22',
- 'ssh_timeout': 600,
- 'ping_parameter': "-s 2048"
- },
- 'sla': {'status': 'True',
- 'action': 'assert'}
- }
-
- result = {}
-
- obj = check_connectivity.CheckConnectivity(args, {})
- obj.setup()
- mock_ssh.SSH.execute.return_value = (0, '100', '')
-
-
- @mock.patch('yardstick.benchmark.scenarios.lib.check_connectivity.ssh')
- def test_check_connectivity_key(self, mock_ssh):
-
- args = {
- 'options': {'ssh_user': 'root',
- 'ssh_key': '/root/.ssh/id_rsa',
- 'ssh_port': '22',
- 'ssh_timeout': 600,
- 'ping_parameter': "-s 2048"
- },
- 'sla': {'status': 'True',
- 'action': 'assert'}
- }
-
- result = {}
-
- obj = check_connectivity.CheckConnectivity(args, self.ctx)
- obj.setup()
-
- mock_ssh.SSH.execute.return_value = (0, '100', '')
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_check_numa_info.py b/tests/unit/benchmark/scenarios/lib/test_check_numa_info.py
deleted file mode 100644
index 1dd461d41..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_check_numa_info.py
+++ /dev/null
@@ -1,85 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-
-from yardstick.benchmark.scenarios.lib.check_numa_info import CheckNumaInfo
-
-
-class CheckNumaInfoTestCase(unittest.TestCase):
-
- @mock.patch(
- 'yardstick.benchmark.scenarios.lib.check_numa_info.CheckNumaInfo._check_vm2_status')
- def test_check_numa_info(self, mock_check_vm2):
- scenario_cfg = {'info1': {}, 'info2': {}}
- obj = CheckNumaInfo(scenario_cfg, {})
- obj.run({})
- self.assertTrue(mock_check_vm2.called)
-
- def test_check_vm2_status_length_eq_1(self):
- info1 = {
- 'pinning': [0],
- 'vcpupin': [{
- 'cpuset': '1,2'
- }]
- }
- info2 = {
- 'pinning': [0],
- 'vcpupin': [{
- 'cpuset': '1,2'
- }]
- }
- scenario_cfg = {'info1': info1, 'info2': info2}
- obj = CheckNumaInfo(scenario_cfg, {})
- status = obj._check_vm2_status(info1, info2)
- self.assertTrue(status)
-
- def test_check_vm2_status_length_gt_1(self):
- info1 = {
- 'pinning': [0, 1],
- 'vcpupin': [{
- 'cpuset': '1,2'
- }]
- }
- info2 = {
- 'pinning': [0, 1],
- 'vcpupin': [{
- 'cpuset': '1,2'
- }]
- }
- scenario_cfg = {'info1': info1, 'info2': info2}
- obj = CheckNumaInfo(scenario_cfg, {})
- status = obj._check_vm2_status(info1, info2)
- self.assertFalse(status)
-
- def test_check_vm2_status_length_not_in_set(self):
- info1 = {
- 'pinning': [0],
- 'vcpupin': [{
- 'cpuset': '1,7'
- }]
- }
- info2 = {
- 'pinning': [0],
- 'vcpupin': [{
- 'cpuset': '1,7'
- }]
- }
- scenario_cfg = {'info1': info1, 'info2': info2}
- obj = CheckNumaInfo(scenario_cfg, {})
- status = obj._check_vm2_status(info1, info2)
- self.assertFalse(status)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_check_value.py b/tests/unit/benchmark/scenarios/lib/test_check_value.py
deleted file mode 100644
index 21e83f830..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_check_value.py
+++ /dev/null
@@ -1,46 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-
-from yardstick.benchmark.scenarios.lib.check_value import CheckValue
-
-
-class CheckValueTestCase(unittest.TestCase):
-
- def test_check_value_eq(self):
- scenario_cfg = {'options': {'operator': 'eq', 'value1': 1, 'value2': 2}}
- obj = CheckValue(scenario_cfg, {})
- try:
- obj.run({})
- except Exception as e:
- self.assertIsInstance(e, AssertionError)
-
- def test_check_value_eq_pass(self):
- scenario_cfg = {'options': {'operator': 'eq', 'value1': 1, 'value2': 1}}
- obj = CheckValue(scenario_cfg, {})
- try:
- obj.run({})
- except Exception as e:
- self.assertIsInstance(e, AssertionError)
-
- def test_check_value_ne(self):
- scenario_cfg = {'options': {'operator': 'ne', 'value1': 1, 'value2': 1}}
- obj = CheckValue(scenario_cfg, {})
- try:
- obj.run({})
- except Exception as e:
- self.assertIsInstance(e, AssertionError)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_create_flavor.py b/tests/unit/benchmark/scenarios/lib/test_create_flavor.py
deleted file mode 100644
index 036ae952d..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_create_flavor.py
+++ /dev/null
@@ -1,37 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-
-from yardstick.benchmark.scenarios.lib.create_flavor import CreateFlavor
-
-
-class CreateFlavorTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.create_flavor')
- def test_create_flavor(self, mock_create_flavor):
- options = {
- 'flavor_name': 'yardstick_test_flavor',
- 'vcpus': '2',
- 'ram': '1024',
- 'disk': '100',
- 'is_public': 'True'
- }
- args = {"options": options}
- obj = CreateFlavor(args, {})
- obj.run({})
- self.assertTrue(mock_create_flavor.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_create_floating_ip.py b/tests/unit/benchmark/scenarios/lib/test_create_floating_ip.py
deleted file mode 100644
index 72dbcd7cd..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_create_floating_ip.py
+++ /dev/null
@@ -1,34 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-
-from yardstick.benchmark.scenarios.lib.create_floating_ip import CreateFloatingIp
-
-
-class CreateFloatingIpTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.create_floating_ip')
- @mock.patch('yardstick.common.openstack_utils.get_network_id')
- @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
- def test_create_floating_ip(self, mock_create_floating_ip, mock_get_network_id, mock_get_neutron_client):
- options = {}
- args = {"options": options}
- obj = CreateFloatingIp(args, {})
- obj.run({})
- self.assertTrue(mock_create_floating_ip.called)
- self.assertTrue(mock_get_network_id.called)
- self.assertTrue(mock_get_neutron_client.called)
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_create_image.py b/tests/unit/benchmark/scenarios/lib/test_create_image.py
deleted file mode 100644
index c213ceba0..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_create_image.py
+++ /dev/null
@@ -1,41 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-
-from yardstick.benchmark.scenarios.lib.create_image import CreateImage
-
-
-class CreateImageTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.create_image')
- @mock.patch('yardstick.common.openstack_utils.get_glance_client')
- def test_create_image(self, mock_get_glance_client, mock_create_image):
- options = {
- 'image_name': 'yardstick_test_image_01',
- 'disk_format': 'qcow2',
- 'container_format': 'bare',
- 'min_disk': '1',
- 'min_ram': '512',
- 'protected': 'False',
- 'tags': '["yardstick automatic test image"]',
- 'file_path': '/home/opnfv/images/cirros-0.3.5-x86_64-disk.img'
- }
- args = {"options": options}
- obj = CreateImage(args, {})
- obj.run({})
- self.assertTrue(mock_create_image.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_create_keypair.py b/tests/unit/benchmark/scenarios/lib/test_create_keypair.py
deleted file mode 100644
index 4b9b72013..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_create_keypair.py
+++ /dev/null
@@ -1,36 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-
-from yardstick.benchmark.scenarios.lib.create_keypair import CreateKeypair
-
-PREFIX = "yardstick.benchmark.scenarios.lib.create_keypair"
-
-
-class CreateKeypairTestCase(unittest.TestCase):
- @mock.patch('{}.paramiko'.format(PREFIX))
- @mock.patch('{}.op_utils'.format(PREFIX))
- def test_create_keypair(self, mock_op_utils, mock_paramiko):
- options = {
- 'key_name': 'yardstick_key',
- 'key_path': '/tmp/yardstick_key'
- }
- args = {"options": options}
- obj = CreateKeypair(args, {})
- obj.run({})
- self.assertTrue(mock_op_utils.create_keypair.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_create_network.py b/tests/unit/benchmark/scenarios/lib/test_create_network.py
deleted file mode 100644
index 8e7d8b5a1..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_create_network.py
+++ /dev/null
@@ -1,39 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-import paramiko
-
-from yardstick.benchmark.scenarios.lib.create_network import CreateNetwork
-
-
-class CreateNetworkTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
- @mock.patch('yardstick.common.openstack_utils.create_neutron_net')
- def test_create_network(self, mock_get_neutron_client, mock_create_neutron_net):
- options = {
- 'openstack_paras': {
- 'name': 'yardstick_net',
- 'admin_state_up': 'True'
- }
- }
- args = {"options": options}
- obj = CreateNetwork(args, {})
- obj.run({})
- self.assertTrue(mock_get_neutron_client.called)
- self.assertTrue(mock_create_neutron_net.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_create_port.py b/tests/unit/benchmark/scenarios/lib/test_create_port.py
deleted file mode 100644
index 3b2aa2247..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_create_port.py
+++ /dev/null
@@ -1,36 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-import paramiko
-
-from yardstick.benchmark.scenarios.lib.create_port import CreatePort
-
-
-class CreatePortTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
- def test_create_port(self, mock_get_neutron_client):
- options = {
- 'openstack_paras': {
- 'name': 'yardstick_port'
- }
- }
- args = {"options": options}
- obj = CreatePort(args, {})
- obj.run({})
- self.assertTrue(mock_get_neutron_client.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_create_router.py b/tests/unit/benchmark/scenarios/lib/test_create_router.py
deleted file mode 100644
index b956a3634..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_create_router.py
+++ /dev/null
@@ -1,39 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-import paramiko
-
-from yardstick.benchmark.scenarios.lib.create_router import CreateRouter
-
-
-class CreateRouterTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
- @mock.patch('yardstick.common.openstack_utils.create_neutron_router')
- def test_create_router(self, mock_get_neutron_client, mock_create_neutron_router):
- options = {
- 'openstack_paras': {
- 'admin_state_up': 'True',
- 'name': 'yardstick_router'
- }
- }
- args = {"options": options}
- obj = CreateRouter(args, {})
- obj.run({})
- self.assertTrue(mock_get_neutron_client.called)
- self.assertTrue(mock_create_neutron_router.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_create_sec_group.py b/tests/unit/benchmark/scenarios/lib/test_create_sec_group.py
deleted file mode 100644
index b962f7f0e..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_create_sec_group.py
+++ /dev/null
@@ -1,39 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-import paramiko
-
-from yardstick.benchmark.scenarios.lib.create_sec_group import CreateSecgroup
-
-
-class CreateSecGroupTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
- @mock.patch('yardstick.common.openstack_utils.create_security_group_full')
- def test_create_sec_group(self, mock_get_neutron_client, mock_create_security_group_full):
- options = {
- 'openstack_paras': {
- 'sg_name': 'yardstick_sec_group',
- 'description': 'security group for yardstick manual VM'
- }
- }
- args = {"options": options}
- obj = CreateSecgroup(args, {})
- obj.run({})
- self.assertTrue(mock_get_neutron_client.called)
- self.assertTrue(mock_create_security_group_full.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_create_server.py b/tests/unit/benchmark/scenarios/lib/test_create_server.py
deleted file mode 100644
index 7c4193132..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_create_server.py
+++ /dev/null
@@ -1,42 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-
-from yardstick.benchmark.scenarios.lib.create_server import CreateServer
-
-
-class CreateServerTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.create_instance_and_wait_for_active')
- @mock.patch('yardstick.common.openstack_utils.get_nova_client')
- @mock.patch('yardstick.common.openstack_utils.get_glance_client')
- @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
- def test_create_server(self, mock_get_nova_client, mock_get_neutron_client,
- mock_get_glance_client, mock_create_instance_and_wait_for_active):
- scenario_cfg = {
- 'options' : {
- 'openstack_paras': 'example'
- },
- 'output': 'server'
- }
- obj = CreateServer(scenario_cfg, {})
- obj.run({})
- self.assertTrue(mock_get_nova_client.called)
- self.assertTrue(mock_get_glance_client.called)
- self.assertTrue(mock_get_neutron_client.called)
- self.assertTrue(mock_create_instance_and_wait_for_active.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_create_subnet.py b/tests/unit/benchmark/scenarios/lib/test_create_subnet.py
deleted file mode 100644
index 0154755c4..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_create_subnet.py
+++ /dev/null
@@ -1,41 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-import paramiko
-
-from yardstick.benchmark.scenarios.lib.create_subnet import CreateSubnet
-
-
-class CreateSubnetTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
- @mock.patch('yardstick.common.openstack_utils.create_neutron_subnet')
- def test_create_subnet(self, mock_get_neutron_client, mock_create_neutron_subnet):
- options = {
- 'openstack_paras': {
- 'network_id': '123-123-123',
- 'name': 'yardstick_subnet',
- 'cidr': '10.10.10.0/24',
- 'ip_version': '4'
- }
- }
- args = {"options": options}
- obj = CreateSubnet(args, {})
- obj.run({})
- self.assertTrue(mock_get_neutron_client.called)
- self.assertTrue(mock_create_neutron_subnet.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_create_volume.py b/tests/unit/benchmark/scenarios/lib/test_create_volume.py
deleted file mode 100644
index ef2c0ccaf..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_create_volume.py
+++ /dev/null
@@ -1,91 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-
-import yardstick.benchmark.scenarios.lib.create_volume
-
-
-class CreateVolumeTestCase(unittest.TestCase):
-
- def setUp(self):
- self._mock_cinder_client = mock.patch(
- 'yardstick.common.openstack_utils.get_cinder_client')
- self.mock_cinder_client = self._mock_cinder_client.start()
- self._mock_glance_client = mock.patch(
- 'yardstick.common.openstack_utils.get_glance_client')
- self.mock_glance_client = self._mock_glance_client.start()
- self.addCleanup(self._stop_mock)
-
- self.scenario_cfg = {
- "options" :
- {
- 'volume_name': 'yardstick_test_volume_01',
- 'size': '256',
- 'image': 'cirros-0.3.5'
- }
- }
-
- self.scenario = (
- yardstick.benchmark.scenarios.lib.create_volume.CreateVolume(
- scenario_cfg=self.scenario_cfg,
- context_cfg={}))
-
- def _stop_mock(self):
- self._mock_cinder_client.stop()
- self._mock_glance_client.stop()
-
- def test_init(self):
- self.mock_cinder_client.return_value = "All volumes are equal"
- self.mock_glance_client.return_value = "Images are more equal"
-
- expected_vol_name = self.scenario_cfg["options"]["volume_name"]
- expected_vol_size = self.scenario_cfg["options"]["size"]
- expected_im_name = self.scenario_cfg["options"]["image"]
- expected_im_id = None
-
- scenario = (
- yardstick.benchmark.scenarios.lib.create_volume.CreateVolume(
- scenario_cfg=self.scenario_cfg,
- context_cfg={}))
-
- self.assertEqual(expected_vol_name, scenario.volume_name)
- self.assertEqual(expected_vol_size, scenario.volume_size)
- self.assertEqual(expected_im_name, scenario.image_name)
- self.assertEqual(expected_im_id, scenario.image_id)
- self.assertEqual("All volumes are equal", scenario.cinder_client)
- self.assertEqual("Images are more equal", scenario.glance_client)
-
- def test_setup(self):
- self.assertFalse(self.scenario.setup_done)
- self.scenario.setup()
- self.assertTrue(self.scenario.setup_done)
-
- @mock.patch('yardstick.common.openstack_utils.create_volume')
- @mock.patch('yardstick.common.openstack_utils.get_image_id')
- def test_run(self, mock_image_id, mock_create_volume):
- self.scenario.run()
-
- mock_image_id.assert_called_once()
- mock_create_volume.assert_called_once()
-
- @mock.patch.object(
- yardstick.benchmark.scenarios.lib.create_volume.CreateVolume, 'setup')
- def test_run_no_setup(self, scenario_setup):
- self.scenario.setup_done = False
- self.scenario.run()
- scenario_setup.assert_called_once()
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_flavor.py b/tests/unit/benchmark/scenarios/lib/test_delete_flavor.py
deleted file mode 100644
index 4a91b8939..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_delete_flavor.py
+++ /dev/null
@@ -1,35 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-
-from yardstick.benchmark.scenarios.lib.delete_flavor import DeleteFlavor
-
-
-class DeleteFlavorTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.delete_flavor')
- @mock.patch('yardstick.common.openstack_utils.get_nova_client')
- def test_delete_flavor(self, mock_get_nova_client, mock_delete_flavor):
- options = {
- 'flavor_name': 'yardstick_test_flavor'
- }
- args = {"options": options}
- obj = DeleteFlavor(args, {})
- obj.run({})
- self.assertTrue(mock_get_nova_client.called)
- self.assertTrue(mock_delete_flavor.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_floating_ip.py b/tests/unit/benchmark/scenarios/lib/test_delete_floating_ip.py
deleted file mode 100644
index 7592c8070..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_delete_floating_ip.py
+++ /dev/null
@@ -1,36 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-import paramiko
-
-from yardstick.benchmark.scenarios.lib.delete_floating_ip import DeleteFloatingIp
-
-
-class DeleteFloatingIpTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.get_nova_client')
- @mock.patch('yardstick.common.openstack_utils.delete_floating_ip')
- def test_delete_floating_ip(self, mock_get_nova_client, mock_delete_floating_ip):
- options = {
- 'floating_ip_id': '123-123-123'
- }
- args = {"options": options}
- obj = DeleteFloatingIp(args, {})
- obj.run({})
- self.assertTrue(mock_get_nova_client.called)
- self.assertTrue(mock_delete_floating_ip.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_image.py b/tests/unit/benchmark/scenarios/lib/test_delete_image.py
deleted file mode 100644
index 2bbf14d16..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_delete_image.py
+++ /dev/null
@@ -1,36 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-
-from yardstick.benchmark.scenarios.lib.delete_image import DeleteImage
-
-
-class DeleteImageTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.delete_image')
- @mock.patch('yardstick.common.openstack_utils.get_image_id')
- @mock.patch('yardstick.common.openstack_utils.get_glance_client')
- def test_delete_image(self, mock_get_glance_client, mock_image_id, mock_delete_image):
- options = {
- 'image_name': 'yardstick_test_image_01'
- }
- args = {"options": options}
- obj = DeleteImage(args, {})
- obj.run({})
- self.assertTrue(mock_delete_image.called)
- self.assertTrue(mock_image_id.called)
- self.assertTrue(mock_get_glance_client.called)
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_keypair.py b/tests/unit/benchmark/scenarios/lib/test_delete_keypair.py
deleted file mode 100644
index 9663fe9fb..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_delete_keypair.py
+++ /dev/null
@@ -1,36 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-import paramiko
-
-from yardstick.benchmark.scenarios.lib.delete_keypair import DeleteKeypair
-
-
-class DeleteKeypairTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.get_nova_client')
- @mock.patch('yardstick.common.openstack_utils.delete_keypair')
- def test_detach_volume(self, mock_get_nova_client, mock_delete_keypair):
- options = {
- 'key_name': 'yardstick_key'
- }
- args = {"options": options}
- obj = DeleteKeypair(args, {})
- obj.run({})
- self.assertTrue(mock_get_nova_client.called)
- self.assertTrue(mock_delete_keypair.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_network.py b/tests/unit/benchmark/scenarios/lib/test_delete_network.py
deleted file mode 100644
index 9ccaa8232..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_delete_network.py
+++ /dev/null
@@ -1,36 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-import paramiko
-
-from yardstick.benchmark.scenarios.lib.delete_network import DeleteNetwork
-
-
-class DeleteNetworkTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
- @mock.patch('yardstick.common.openstack_utils.delete_neutron_net')
- def test_delete_network(self, mock_get_neutron_client, mock_delete_neutron_net):
- options = {
- 'network_id': '123-123-123'
- }
- args = {"options": options}
- obj = DeleteNetwork(args, {})
- obj.run({})
- self.assertTrue(mock_get_neutron_client.called)
- self.assertTrue(mock_delete_neutron_net.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_port.py b/tests/unit/benchmark/scenarios/lib/test_delete_port.py
deleted file mode 100644
index 77b9c7009..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_delete_port.py
+++ /dev/null
@@ -1,34 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-import paramiko
-
-from yardstick.benchmark.scenarios.lib.delete_port import DeletePort
-
-
-class DeletePortTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
- def test_delete_port(self, mock_get_neutron_client):
- options = {
- 'port_id': '123-123-123'
- }
- args = {"options": options}
- obj = DeletePort(args, {})
- obj.run({})
- self.assertTrue(mock_get_neutron_client.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_router.py b/tests/unit/benchmark/scenarios/lib/test_delete_router.py
deleted file mode 100644
index ab1ad5d35..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_delete_router.py
+++ /dev/null
@@ -1,36 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-import paramiko
-
-from yardstick.benchmark.scenarios.lib.delete_router import DeleteRouter
-
-
-class DeleteRouterTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
- @mock.patch('yardstick.common.openstack_utils.delete_neutron_router')
- def test_delete_router(self, mock_get_neutron_client, mock_delete_neutron_router):
- options = {
- 'router_id': '123-123-123'
- }
- args = {"options": options}
- obj = DeleteRouter(args, {})
- obj.run({})
- self.assertTrue(mock_get_neutron_client.called)
- self.assertTrue(mock_delete_neutron_router.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_router_gateway.py b/tests/unit/benchmark/scenarios/lib/test_delete_router_gateway.py
deleted file mode 100644
index 1150dccda..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_delete_router_gateway.py
+++ /dev/null
@@ -1,36 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-import paramiko
-
-from yardstick.benchmark.scenarios.lib.delete_router_gateway import DeleteRouterGateway
-
-
-class DeleteRouterGatewayTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
- @mock.patch('yardstick.common.openstack_utils.remove_gateway_router')
- def test_delete_router_gateway(self, mock_get_neutron_client, mock_remove_gateway_router):
- options = {
- 'router_id': '123-123-123'
- }
- args = {"options": options}
- obj = DeleteRouterGateway(args, {})
- obj.run({})
- self.assertTrue(mock_get_neutron_client.called)
- self.assertTrue(mock_remove_gateway_router.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_router_interface.py b/tests/unit/benchmark/scenarios/lib/test_delete_router_interface.py
deleted file mode 100644
index 2cc9c9f37..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_delete_router_interface.py
+++ /dev/null
@@ -1,37 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-import paramiko
-
-from yardstick.benchmark.scenarios.lib.delete_router_interface import DeleteRouterInterface
-
-
-class DeleteRouterInterfaceTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
- @mock.patch('yardstick.common.openstack_utils.remove_interface_router')
- def test_delete_router_interface(self, mock_get_neutron_client, mock_remove_interface_router):
- options = {
- 'router_id': '123-123-123',
- 'subnet_id': '321-321-321'
- }
- args = {"options": options}
- obj = DeleteRouterInterface(args, {})
- obj.run({})
- self.assertTrue(mock_get_neutron_client.called)
- self.assertTrue(mock_remove_interface_router.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_server.py b/tests/unit/benchmark/scenarios/lib/test_delete_server.py
deleted file mode 100644
index 622ead5ac..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_delete_server.py
+++ /dev/null
@@ -1,35 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-
-from yardstick.benchmark.scenarios.lib.delete_server import DeleteServer
-
-
-class DeleteServerTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.delete_instance')
- @mock.patch('yardstick.common.openstack_utils.get_nova_client')
- def test_delete_server(self, mock_get_nova_client, mock_delete_instance):
- options = {
- 'server_id': '1234-4567-0000'
- }
- args = {"options": options}
- obj = DeleteServer(args, {})
- obj.run({})
- self.assertTrue(mock_get_nova_client.called)
- self.assertTrue(mock_delete_instance.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_volume.py b/tests/unit/benchmark/scenarios/lib/test_delete_volume.py
deleted file mode 100644
index a11d0121b..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_delete_volume.py
+++ /dev/null
@@ -1,36 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-import paramiko
-
-from yardstick.benchmark.scenarios.lib.delete_volume import DeleteVolume
-
-
-class DeleteVolumeTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.get_cinder_client')
- @mock.patch('yardstick.common.openstack_utils.delete_volume')
- def test_delete_volume(self, mock_get_cinder_client, mock_delete_volume):
- options = {
- 'volume_id': '123-123-123'
- }
- args = {"options": options}
- obj = DeleteVolume(args, {})
- obj.run({})
- self.assertTrue(mock_get_cinder_client.called)
- self.assertTrue(mock_delete_volume.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_detach_volume.py b/tests/unit/benchmark/scenarios/lib/test_detach_volume.py
deleted file mode 100644
index 0cffcba15..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_detach_volume.py
+++ /dev/null
@@ -1,35 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-import paramiko
-
-from yardstick.benchmark.scenarios.lib.detach_volume import DetachVolume
-
-
-class DetachVolumeTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.detach_volume')
- def test_detach_volume(self, mock_detach_volume):
- options = {
- 'server_id': '321-321-321',
- 'volume_id': '123-123-123'
- }
- args = {"options": options}
- obj = DetachVolume(args, {})
- obj.run({})
- self.assertTrue(mock_detach_volume.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_get_flavor.py b/tests/unit/benchmark/scenarios/lib/test_get_flavor.py
deleted file mode 100644
index bf12e0a32..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_get_flavor.py
+++ /dev/null
@@ -1,33 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-
-from yardstick.benchmark.scenarios.lib.get_flavor import GetFlavor
-
-
-class GetFlavorTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.get_flavor_by_name')
- def test_get_flavor(self, mock_get_flavor_by_name):
- options = {
- 'flavor_name': 'yardstick_test_flavor'
- }
- args = {"options": options}
- obj = GetFlavor(args, {})
- obj.run({})
- self.assertTrue(mock_get_flavor_by_name.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_get_migrate_target_host.py b/tests/unit/benchmark/scenarios/lib/test_get_migrate_target_host.py
deleted file mode 100644
index f046c92ea..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_get_migrate_target_host.py
+++ /dev/null
@@ -1,51 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-
-from yardstick.benchmark.scenarios.lib.get_migrate_target_host import GetMigrateTargetHost
-
-BASE = 'yardstick.benchmark.scenarios.lib.get_migrate_target_host'
-
-
-class GetMigrateTargetHostTestCase(unittest.TestCase):
-
- @mock.patch('{}.openstack_utils.get_nova_client'.format(BASE))
- @mock.patch('{}.GetMigrateTargetHost._get_migrate_host'.format(BASE))
- @mock.patch('{}.GetMigrateTargetHost._get_current_host_name'.format(BASE))
- def test_get_migrate_target_host(self,
- mock_get_current_host_name,
- mock_get_migrate_host,
- mock_get_nova_client):
- obj = GetMigrateTargetHost({}, {})
- obj.run({})
- self.assertTrue(mock_get_nova_client.called)
- self.assertTrue(mock_get_current_host_name.called)
- self.assertTrue(mock_get_migrate_host.called)
-
- @mock.patch('{}.openstack_utils.get_nova_client'.format(BASE))
- def test_get_migrate_host(self, mock_get_nova_client):
- class A(object):
- def __init__(self, service):
- self.service = service
- self.host = 'host4'
-
- mock_get_nova_client().hosts.list_all.return_value = [A('compute')]
- obj = GetMigrateTargetHost({}, {})
- host = obj._get_migrate_host('host5')
- self.assertTrue(mock_get_nova_client.called)
- self.assertEqual(host, 'host4')
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_get_numa_info.py b/tests/unit/benchmark/scenarios/lib/test_get_numa_info.py
deleted file mode 100644
index 680692fdc..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_get_numa_info.py
+++ /dev/null
@@ -1,106 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-
-from yardstick.benchmark.scenarios.lib.get_numa_info import GetNumaInfo
-
-BASE = 'yardstick.benchmark.scenarios.lib.get_numa_info'
-
-
-class GetNumaInfoTestCase(unittest.TestCase):
-
- @mock.patch('{}.GetNumaInfo._check_numa_node'.format(BASE))
- @mock.patch('{}.GetNumaInfo._get_current_host_name'.format(BASE))
- @mock.patch('yardstick.benchmark.scenarios.lib.get_numa_info.yaml_load')
- @mock.patch('yardstick.common.task_template.TaskTemplate.render')
- def test_get_numa_info(self,
- mock_render,
- mock_safe_load,
- mock_get_current_host_name,
- mock_check_numa_node):
- scenario_cfg = {
- 'options': {
- 'server': {
- 'id': '1'
- },
- 'file': 'yardstick/ssh.py'
- },
- 'output': 'numa_info'
- }
- mock_safe_load.return_value = {
- 'nodes': []
- }
- obj = GetNumaInfo(scenario_cfg, {})
- obj.run({})
- self.assertTrue(mock_get_current_host_name.called)
- self.assertTrue(mock_check_numa_node.called)
-
- @mock.patch('yardstick.ssh.SSH.from_node')
- @mock.patch('{}.GetNumaInfo._get_current_host_name'.format(BASE))
- @mock.patch('yardstick.benchmark.scenarios.lib.get_numa_info.yaml_load')
- @mock.patch('yardstick.common.task_template.TaskTemplate.render')
- def test_check_numa_node(self,
- mock_render,
- mock_safe_load,
- mock_get_current_host_name,
- mock_from_node):
- scenario_cfg = {
- 'options': {
- 'server': {
- 'id': '1'
- },
- 'file': 'yardstick/ssh.py'
- },
- 'output': 'numa_info'
- }
- mock_safe_load.return_value = {
- 'nodes': []
- }
- data = """
- <data>
- </data>
- """
- mock_from_node().execute.return_value = (0, data, '')
- obj = GetNumaInfo(scenario_cfg, {})
- result = obj._check_numa_node('1', 'host4')
- self.assertEqual(result, {'pinning': [], 'vcpupin': []})
-
- @mock.patch('{}.change_obj_to_dict'.format(BASE))
- @mock.patch('{}.get_nova_client'.format(BASE))
- @mock.patch('yardstick.benchmark.scenarios.lib.get_numa_info.yaml_load')
- @mock.patch('yardstick.common.task_template.TaskTemplate.render')
- def test_get_current_host_name(self,
- mock_render,
- mock_safe_load,
- mock_get_nova_client,
- mock_change_obj_to_dict):
- scenario_cfg = {
- 'options': {
- 'server': {
- 'id': '1'
- },
- 'file': 'yardstick/ssh.py'
- },
- 'output': 'numa_info'
- }
- mock_get_nova_client().servers.get.return_value = ''
- mock_change_obj_to_dict.return_value = {'OS-EXT-SRV-ATTR:host': 'host5'}
-
- obj = GetNumaInfo(scenario_cfg, {})
- result = obj._get_current_host_name('1')
- self.assertEqual(result, 'host5')
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_get_server.py b/tests/unit/benchmark/scenarios/lib/test_get_server.py
deleted file mode 100644
index aebbf5416..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_get_server.py
+++ /dev/null
@@ -1,50 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-import mock
-
-from yardstick.benchmark.scenarios.lib.get_server import GetServer
-
-
-class GetServerTestCase(unittest.TestCase):
-
- @mock.patch('yardstick.common.openstack_utils.get_server_by_name')
- @mock.patch('yardstick.common.openstack_utils.get_nova_client')
- def test_get_server_with_name(self, mock_get_nova_client, mock_get_server_by_name):
- scenario_cfg = {
- 'options': {
- 'server_name': 'yardstick_server'
- },
- 'output': 'status server'
- }
- obj = GetServer(scenario_cfg, {})
- obj.run({})
- self.assertTrue(mock_get_nova_client.called)
- self.assertTrue(mock_get_server_by_name.called)
-
- @mock.patch('yardstick.common.openstack_utils.get_nova_client')
- def test_get_server_with_id(self, mock_get_nova_client):
- scenario_cfg = {
- 'options': {
- 'server_id': '1'
- },
- 'output': 'status server'
- }
- mock_get_nova_client().servers.get.return_value = None
- obj = GetServer(scenario_cfg, {})
- obj.run({})
- self.assertTrue(mock_get_nova_client.called)
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_get_server_ip.py b/tests/unit/benchmark/scenarios/lib/test_get_server_ip.py
deleted file mode 100644
index 3d20d5439..000000000
--- a/tests/unit/benchmark/scenarios/lib/test_get_server_ip.py
+++ /dev/null
@@ -1,41 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-import unittest
-
-from yardstick.benchmark.scenarios.lib.get_server_ip import GetServerIp
-
-
-class GetServerIpTestCase(unittest.TestCase):
- def test_get_server_ip(self):
- scenario_cfg = {
- 'options': {
- 'server': {
- 'addresses': {
- 'net1': [
- {
- 'OS-EXT-IPS:type': 'floating',
- 'addr': '127.0.0.1'
- }
- ]
- }
- }
- },
- 'output': 'ip'
- }
- obj = GetServerIp(scenario_cfg, {})
- result = obj.run({})
- self.assertEqual(result, {'ip': '127.0.0.1'})
-
-
-def main():
- unittest.main()
-
-
-if __name__ == '__main__':
- main()