aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--functest/ci/config_functest.yaml1
-rw-r--r--functest/opnfv_tests/openstack/tempest/conf_utils.py21
-rw-r--r--functest/opnfv_tests/openstack/tempest/tempest.py232
-rw-r--r--functest/tests/unit/openstack/tempest/test_conf_utils.py92
-rw-r--r--functest/tests/unit/openstack/tempest/test_tempest.py50
5 files changed, 141 insertions, 255 deletions
diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml
index 5dc938b6c..2cdec4500 100644
--- a/functest/ci/config_functest.yaml
+++ b/functest/ci/config_functest.yaml
@@ -127,7 +127,6 @@ tempest:
private_subnet_name: tempest-subnet
private_subnet_cidr: 192.168.150.0/24
router_name: tempest-router
- use_custom_flavors: 'False'
rally:
deployment_name: opnfv-rally
diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py
index 6a3d2d6e8..36ff77f55 100644
--- a/functest/opnfv_tests/openstack/tempest/conf_utils.py
+++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py
@@ -23,8 +23,6 @@ from functest.utils import config
from functest.utils import env
-IMAGE_ID_ALT = None
-FLAVOR_ID_ALT = None
RALLY_CONF_PATH = "/etc/rally/rally.conf"
RALLY_AARCH64_PATCH_PATH = pkg_resources.resource_filename(
'functest', 'ci/rally_aarch64_patch.conf')
@@ -183,9 +181,9 @@ def update_tempest_conf_file(conf_file, rconfig):
rconfig.write(config_file)
-def configure_tempest_update_params(tempest_conf_file,
- network_name=None, image_id=None,
- flavor_id=None, compute_cnt=1):
+def configure_tempest_update_params(
+ tempest_conf_file, network_name=None, image_id=None, flavor_id=None,
+ compute_cnt=1, image_alt_id=None, flavor_alt_id=None):
# pylint: disable=too-many-branches, too-many-arguments
"""
Add/update needed parameters into tempest.conf file
@@ -197,13 +195,12 @@ def configure_tempest_update_params(tempest_conf_file,
rconfig.set('compute', 'volume_device_name', env.get('VOLUME_DEVICE_NAME'))
if image_id is not None:
rconfig.set('compute', 'image_ref', image_id)
- if IMAGE_ID_ALT is not None:
- rconfig.set('compute', 'image_ref_alt', IMAGE_ID_ALT)
- if getattr(config.CONF, 'tempest_use_custom_flavors'):
- if flavor_id is not None:
- rconfig.set('compute', 'flavor_ref', flavor_id)
- if FLAVOR_ID_ALT is not None:
- rconfig.set('compute', 'flavor_ref_alt', FLAVOR_ID_ALT)
+ if image_alt_id is not None:
+ rconfig.set('compute', 'image_ref_alt', image_alt_id)
+ if flavor_id is not None:
+ rconfig.set('compute', 'flavor_ref', flavor_id)
+ if flavor_alt_id is not None:
+ rconfig.set('compute', 'flavor_ref_alt', flavor_alt_id)
if compute_cnt > 1:
# enable multinode tests
rconfig.set('compute', 'min_compute_nodes', compute_cnt)
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py
index b9b6e37b3..285dc44f0 100644
--- a/functest/opnfv_tests/openstack/tempest/tempest.py
+++ b/functest/opnfv_tests/openstack/tempest/tempest.py
@@ -20,17 +20,11 @@ import subprocess
import time
import uuid
-from snaps.config.flavor import FlavorConfig
-from snaps.config.network import NetworkConfig, SubnetConfig
-from snaps.config.project import ProjectConfig
-from snaps.config.user import UserConfig
-from snaps.openstack.create_flavor import OpenStackFlavor
-from snaps.openstack.tests import openstack_tests
-from snaps.openstack.utils import deploy_utils
+import os_client_config
+import shade
from xtesting.core import testcase
import yaml
-from functest.opnfv_tests.openstack.snaps import snaps_utils
from functest.opnfv_tests.openstack.tempest import conf_utils
from functest.utils import config
from functest.utils import env
@@ -47,7 +41,7 @@ class TempestCommon(testcase.TestCase):
def __init__(self, **kwargs):
super(TempestCommon, self).__init__(**kwargs)
- self.resources = TempestResourcesManager(**kwargs)
+ self.resources = TempestResourcesManager()
self.mode = ""
self.option = []
self.verifier_id = conf_utils.get_verifier_id()
@@ -267,15 +261,16 @@ class TempestCommon(testcase.TestCase):
"""
if not os.path.exists(self.res_dir):
os.makedirs(self.res_dir)
- resources = self.resources.create()
- compute_cnt = snaps_utils.get_active_compute_cnt(
- self.resources.os_creds)
+ self.resources.create()
+ compute_cnt = len(self.resources.cloud.list_hypervisors())
self.conf_file = conf_utils.configure_verifier(self.deployment_dir)
conf_utils.configure_tempest_update_params(
- self.conf_file, network_name=resources.get("network_name"),
- image_id=resources.get("image_id"),
- flavor_id=resources.get("flavor_id"),
- compute_cnt=compute_cnt)
+ self.conf_file, network_name=self.resources.network.id,
+ image_id=self.resources.image.id,
+ flavor_id=self.resources.flavor.id,
+ compute_cnt=compute_cnt,
+ image_alt_id=self.resources.image_alt.id,
+ flavor_alt_id=self.resources.flavor_alt.id)
self.backup_tempest_config(self.conf_file, self.res_dir)
def run(self, **kwargs):
@@ -367,152 +362,119 @@ class TempestDefcore(TempestCommon):
class TempestResourcesManager(object):
+ # pylint: disable=too-many-instance-attributes
"""Tempest resource manager."""
- def __init__(self, **kwargs):
- self.os_creds = kwargs.get('os_creds') or snaps_utils.get_credentials()
+ def __init__(self):
self.guid = '-' + str(uuid.uuid4())
- self.creators = list()
- self.cirros_image_config = getattr(
- config.CONF, 'snaps_images_cirros', None)
+ self.cloud = shade.OperatorCloud(
+ cloud_config=os_client_config.get_config())
+ self.domain_id = self.cloud.auth["project_domain_id"]
+ self.project = None
+ self.user = None
+ self.network = None
+ self.subnet = None
+ self.image = None
+ self.image_alt = None
+ self.flavor = None
+ self.flavor_alt = None
def _create_project(self):
"""Create project for tests."""
- project_creator = deploy_utils.create_project(
- self.os_creds, ProjectConfig(
- name=getattr(
- config.CONF, 'tempest_identity_tenant_name') + self.guid,
- description=getattr(
- config.CONF, 'tempest_identity_tenant_description'),
- domain=self.os_creds.project_domain_name))
- if project_creator is None or project_creator.get_project() is None:
- raise Exception("Failed to create tenant")
- self.creators.append(project_creator)
- return project_creator.get_project().id
+ self.project = self.cloud.create_project(
+ getattr(config.CONF, 'tempest_identity_tenant_name') + self.guid,
+ description=getattr(
+ config.CONF, 'tempest_identity_tenant_description'),
+ domain_id=self.domain_id)
+ LOGGER.debug("project: %s", self.project)
def _create_user(self):
"""Create user for tests."""
- user_creator = deploy_utils.create_user(
- self.os_creds, UserConfig(
- name=getattr(
- config.CONF, 'tempest_identity_user_name') + self.guid,
- password=getattr(
- config.CONF, 'tempest_identity_user_password'),
- project_name=getattr(
- config.CONF, 'tempest_identity_tenant_name') + self.guid,
- domain_name=self.os_creds.user_domain_name))
- if user_creator is None or user_creator.get_user() is None:
- raise Exception("Failed to create user")
- self.creators.append(user_creator)
- return user_creator.get_user().id
-
- def _create_network(self, project_name):
+ self.user = self.cloud.create_user(
+ name=getattr(
+ config.CONF, 'tempest_identity_user_name') + self.guid,
+ password=getattr(config.CONF, 'tempest_identity_user_password'),
+ default_project=getattr(
+ config.CONF, 'tempest_identity_tenant_name') + self.guid,
+ domain_id=self.domain_id)
+ LOGGER.debug("user: %s", self.user)
+
+ def _create_network(self):
"""Create network for tests."""
- tempest_network_type = None
- tempest_physical_network = None
- tempest_segmentation_id = None
-
- tempest_network_type = getattr(
- config.CONF, 'tempest_network_type', None)
- tempest_physical_network = getattr(
- config.CONF, 'tempest_physical_network', None)
- tempest_segmentation_id = getattr(
- config.CONF, 'tempest_segmentation_id', None)
tempest_net_name = getattr(
config.CONF, 'tempest_private_net_name') + self.guid
-
- network_creator = deploy_utils.create_network(
- self.os_creds, NetworkConfig(
- name=tempest_net_name,
- project_name=project_name,
- network_type=tempest_network_type,
- physical_network=tempest_physical_network,
- segmentation_id=tempest_segmentation_id,
- subnet_settings=[SubnetConfig(
- name=getattr(
- config.CONF,
- 'tempest_private_subnet_name') + self.guid,
- project_name=project_name,
- cidr=getattr(
- config.CONF, 'tempest_private_subnet_cidr'),
- dns_nameservers=[env.get('NAMESERVER')])]))
- if network_creator is None or network_creator.get_network() is None:
- raise Exception("Failed to create private network")
- self.creators.append(network_creator)
- return tempest_net_name
+ provider = {}
+ if hasattr(config.CONF, 'tempest_network_type'):
+ provider["network_type"] = getattr(
+ config.CONF, 'tempest_network_type')
+ if hasattr(config.CONF, 'tempest_physical_network'):
+ provider["physical_network"] = getattr(
+ config.CONF, 'tempest_physical_network')
+ if hasattr(config.CONF, 'tempest_segmentation_id'):
+ provider["segmentation_id"] = getattr(
+ config.CONF, 'tempest_segmentation_id')
+ LOGGER.info(
+ "Creating network with name: '%s'", tempest_net_name)
+ self.network = self.cloud.create_network(
+ tempest_net_name, provider=provider)
+ LOGGER.debug("network: %s", self.network)
+
+ self.subnet = self.cloud.create_subnet(
+ self.network.id,
+ subnet_name=getattr(
+ config.CONF, 'tempest_private_subnet_name') + self.guid,
+ cidr=getattr(config.CONF, 'tempest_private_subnet_cidr'),
+ enable_dhcp=True,
+ dns_nameservers=[env.get('NAMESERVER')])
+ LOGGER.debug("subnet: %s", self.subnet)
def _create_image(self, name):
"""Create image for tests"""
- os_image_settings = openstack_tests.cirros_image_settings(
- name, public=True,
- image_metadata=self.cirros_image_config)
- image_creator = deploy_utils.create_image(
- self.os_creds, os_image_settings)
- if image_creator is None:
- raise Exception('Failed to create image')
- self.creators.append(image_creator)
- return image_creator.get_image().id
+ LOGGER.info("Creating image with name: '%s'", name)
+ image = self.cloud.create_image(
+ name, filename=getattr(config.CONF, 'openstack_image_url'),
+ is_public=True)
+ LOGGER.debug("image: %s", image)
+ return image
def _create_flavor(self, name):
"""Create flavor for tests."""
- flavor_metadata = getattr(config.CONF, 'flavor_extra_specs', None)
- flavor_creator = OpenStackFlavor(
- self.os_creds, FlavorConfig(
- name=name,
- ram=getattr(config.CONF, 'openstack_flavor_ram'),
- disk=getattr(config.CONF, 'openstack_flavor_disk'),
- vcpus=getattr(config.CONF, 'openstack_flavor_vcpus'),
- metadata=flavor_metadata))
- flavor = flavor_creator.create()
- if flavor is None:
- raise Exception('Failed to create flavor')
- self.creators.append(flavor_creator)
- return flavor.id
+ flavor = self.cloud.create_flavor(
+ name, getattr(config.CONF, 'openstack_flavor_ram'),
+ getattr(config.CONF, 'openstack_flavor_vcpus'),
+ getattr(config.CONF, 'openstack_flavor_disk'))
+ self.cloud.set_flavor_specs(
+ flavor.id, getattr(config.CONF, 'flavor_extra_specs', {}))
+ LOGGER.debug("flavor: %s", flavor)
+ return flavor
def create(self, create_project=False):
"""Create resources for Tempest test suite."""
- result = {
- 'tempest_net_name': None,
- 'image_id': None,
- 'image_id_alt': None,
- 'flavor_id': None,
- 'flavor_id_alt': None
- }
- project_name = None
-
if create_project:
- LOGGER.debug("Creating project and user for Tempest suite")
- project_name = getattr(
- config.CONF, 'tempest_identity_tenant_name') + self.guid
- result['project_id'] = self._create_project()
- result['user_id'] = self._create_user()
- result['tenant_id'] = result['project_id'] # for compatibility
-
- LOGGER.debug("Creating private network for Tempest suite")
- result['tempest_net_name'] = self._create_network(project_name)
+ self._create_project()
+ self._create_user()
+ self._create_network()
LOGGER.debug("Creating two images for Tempest suite")
- image_name = getattr(config.CONF, 'openstack_image_name') + self.guid
- result['image_id'] = self._create_image(image_name)
- image_name = getattr(
- config.CONF, 'openstack_image_name_alt') + self.guid
- result['image_id_alt'] = self._create_image(image_name)
+ self.image = self._create_image(
+ getattr(config.CONF, 'openstack_image_name') + self.guid)
+ self.image_alt = self._create_image(
+ getattr(config.CONF, 'openstack_image_name_alt') + self.guid)
LOGGER.info("Creating two flavors for Tempest suite")
- name = getattr(config.CONF, 'openstack_flavor_name') + self.guid
- result['flavor_id'] = self._create_flavor(name)
-
- name = getattr(
- config.CONF, 'openstack_flavor_name_alt') + self.guid
- result['flavor_id_alt'] = self._create_flavor(name)
-
- return result
+ self.flavor = self._create_flavor(
+ getattr(config.CONF, 'openstack_flavor_name') + self.guid)
+ self.flavor_alt = self._create_flavor(
+ getattr(config.CONF, 'openstack_flavor_name_alt') + self.guid)
def cleanup(self):
"""
Cleanup all OpenStack objects. Should be called on completion.
"""
- for creator in reversed(self.creators):
- try:
- creator.clean()
- except Exception as err: # pylint: disable=broad-except
- LOGGER.error('Unexpected error cleaning - %s', err)
+ self.cloud.delete_image(self.image)
+ self.cloud.delete_image(self.image_alt)
+ self.cloud.delete_network(self.network.id)
+ self.cloud.delete_flavor(self.flavor.id)
+ self.cloud.delete_flavor(self.flavor_alt.id)
+ if self.project:
+ self.cloud.delete_user(self.user.id)
+ self.cloud.delete_project(self.project.id)
diff --git a/functest/tests/unit/openstack/tempest/test_conf_utils.py b/functest/tests/unit/openstack/tempest/test_conf_utils.py
index 8988e96a1..e63fd2bb6 100644
--- a/functest/tests/unit/openstack/tempest/test_conf_utils.py
+++ b/functest/tests/unit/openstack/tempest/test_conf_utils.py
@@ -14,73 +14,11 @@ import unittest
import mock
from functest.opnfv_tests.openstack.tempest import conf_utils
-from functest.opnfv_tests.openstack.tempest import tempest
from functest.utils import config
-from snaps.openstack.os_credentials import OSCreds
class OSTempestConfUtilsTesting(unittest.TestCase):
# pylint: disable=too-many-public-methods
- def setUp(self):
- self.os_creds = OSCreds(
- username='user', password='pass',
- auth_url='http://foo.com:5000/v3', project_name='bar')
-
- @mock.patch('snaps.openstack.utils.deploy_utils.create_project',
- return_value=mock.Mock())
- @mock.patch('snaps.openstack.utils.deploy_utils.create_user',
- return_value=mock.Mock())
- @mock.patch('snaps.openstack.utils.deploy_utils.create_network',
- return_value=None)
- @mock.patch('snaps.openstack.utils.deploy_utils.create_image',
- return_value=mock.Mock())
- def test_create_res_missing_net_dic(self, *mock_args):
- # pylint: disable=unused-argument
- tempest_resources = tempest.TempestResourcesManager(
- os_creds=self.os_creds)
- with self.assertRaises(Exception) as context:
- tempest_resources.create()
- msg = 'Failed to create private network'
- self.assertTrue(msg in context.exception)
-
- @mock.patch('snaps.openstack.utils.deploy_utils.create_project',
- return_value=mock.Mock())
- @mock.patch('snaps.openstack.utils.deploy_utils.create_user',
- return_value=mock.Mock())
- @mock.patch('snaps.openstack.utils.deploy_utils.create_network',
- return_value=mock.Mock())
- @mock.patch('snaps.openstack.utils.deploy_utils.create_image',
- return_value=None)
- def test_create_res_missing_image(self, *mock_args):
- # pylint: disable=unused-argument
- tempest_resources = tempest.TempestResourcesManager(
- os_creds=self.os_creds)
-
- with self.assertRaises(Exception) as context:
- tempest_resources.create()
- msg = 'Failed to create image'
- self.assertTrue(msg in context.exception, msg=str(context.exception))
-
- @mock.patch('snaps.openstack.utils.deploy_utils.create_project',
- return_value=mock.Mock())
- @mock.patch('snaps.openstack.utils.deploy_utils.create_user',
- return_value=mock.Mock())
- @mock.patch('snaps.openstack.utils.deploy_utils.create_network',
- return_value=mock.Mock())
- @mock.patch('snaps.openstack.utils.deploy_utils.create_image',
- return_value=mock.Mock())
- @mock.patch('snaps.openstack.utils.keystone_utils.keystone_client')
- @mock.patch('snaps.openstack.utils.keystone_utils.get_project')
- @mock.patch('snaps.openstack.create_flavor.OpenStackFlavor.create',
- return_value=None)
- def test_create_res_missing_flavor(self, *mock_args):
- # pylint: disable=unused-argument
- tempest_resources = tempest.TempestResourcesManager(
- os_creds=self.os_creds)
- with self.assertRaises(Exception) as context:
- tempest_resources.create()
- msg = 'Failed to create flavor'
- self.assertTrue(msg in context.exception, msg=str(context.exception))
@mock.patch('subprocess.check_output')
def test_create_rally_deployment(self, mock_exec):
@@ -188,7 +126,7 @@ class OSTempestConfUtilsTesting(unittest.TestCase):
self.assertTrue(mock_get_vid.called)
self.assertTrue(mock_get_did.called)
- def _test_missing_param(self, params, image_id, flavor_id):
+ def _test_missing_param(self, params, image_id, flavor_id, alt=False):
with mock.patch('functest.opnfv_tests.openstack.tempest.'
'conf_utils.ConfigParser.RawConfigParser.'
'set') as mset, \
@@ -202,10 +140,16 @@ class OSTempestConfUtilsTesting(unittest.TestCase):
mock.patch('functest.utils.functest_utils.yaml.safe_load',
return_value={'validation': {'ssh_timeout': 300}}):
os.environ['OS_ENDPOINT_TYPE'] = ''
- conf_utils.configure_tempest_update_params(
- 'test_conf_file', image_id=image_id,
- flavor_id=flavor_id)
- mset.assert_any_call(params[0], params[1], params[2])
+ if not alt:
+ conf_utils.configure_tempest_update_params(
+ 'test_conf_file', image_id=image_id,
+ flavor_id=flavor_id)
+ mset.assert_any_call(params[0], params[1], params[2])
+ else:
+ conf_utils.configure_tempest_update_params(
+ 'test_conf_file', image_alt_id=image_id,
+ flavor_alt_id=flavor_id)
+ mset.assert_any_call(params[0], params[1], params[2])
self.assertTrue(mread.called)
self.assertTrue(mwrite.called)
@@ -214,20 +158,18 @@ class OSTempestConfUtilsTesting(unittest.TestCase):
'test_image_id', None)
def test_upd_missing_image_id_alt(self):
- conf_utils.IMAGE_ID_ALT = 'test_image_id_alt'
- self._test_missing_param(('compute', 'image_ref_alt',
- 'test_image_id_alt'), None, None)
+ self._test_missing_param(
+ ('compute', 'image_ref_alt', 'test_image_id_alt'),
+ 'test_image_id_alt', None, alt=True)
def test_upd_missing_flavor_id(self):
- setattr(config.CONF, 'tempest_use_custom_flavors', 'True')
self._test_missing_param(('compute', 'flavor_ref', 'test_flavor_id'),
None, 'test_flavor_id')
def test_upd_missing_flavor_id_alt(self):
- setattr(config.CONF, 'tempest_use_custom_flavors', 'True')
- conf_utils.FLAVOR_ID_ALT = 'test_flavor_id_alt'
- self._test_missing_param(('compute', 'flavor_ref_alt',
- 'test_flavor_id_alt'), None, None)
+ self._test_missing_param(
+ ('compute', 'flavor_ref_alt', 'test_flavor_id_alt'),
+ None, 'test_flavor_id_alt', alt=True)
def test_verif_missing_conf_file(self):
with mock.patch('functest.opnfv_tests.openstack.tempest.'
diff --git a/functest/tests/unit/openstack/tempest/test_tempest.py b/functest/tests/unit/openstack/tempest/test_tempest.py
index 1fea4e41d..2c78cec5f 100644
--- a/functest/tests/unit/openstack/tempest/test_tempest.py
+++ b/functest/tests/unit/openstack/tempest/test_tempest.py
@@ -12,7 +12,6 @@ import os
import unittest
import mock
-from snaps.openstack.os_credentials import OSCreds
from xtesting.core import testcase
from functest.opnfv_tests.openstack.tempest import tempest
@@ -23,25 +22,20 @@ class OSTempestTesting(unittest.TestCase):
# pylint: disable=too-many-public-methods
def setUp(self):
- os_creds = OSCreds(
- username='user', password='pass',
- auth_url='http://foo.com:5000/v3', project_name='bar')
-
with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
'conf_utils.get_verifier_id',
return_value='test_deploy_id'), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.get_verifier_deployment_id',
- return_value='test_deploy_id'), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.get_verifier_repo_dir',
- return_value='test_verifier_repo_dir'), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.get_verifier_deployment_dir',
- return_value='test_verifier_deploy_dir'), \
- mock.patch('functest.opnfv_tests.openstack.snaps.snaps_utils.'
- 'get_credentials',
- return_value=os_creds):
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.get_verifier_deployment_id',
+ return_value='test_deploy_id'), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.get_verifier_repo_dir',
+ return_value='test_verifier_repo_dir'), \
+ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.get_verifier_deployment_dir',
+ return_value='test_verifier_deploy_dir'), \
+ mock.patch('os_client_config.get_config'), \
+ mock.patch('shade.OperatorCloud'):
self.tempestcommon = tempest.TempestCommon()
self.tempestsmoke_serial = tempest.TempestSmokeSerial()
self.tempestsmoke_parallel = tempest.TempestSmokeParallel()
@@ -189,6 +183,8 @@ class OSTempestTesting(unittest.TestCase):
'os.path.exists', return_value=False)
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.os.makedirs',
side_effect=Exception)
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'TempestResourcesManager.cleanup')
def test_run_makedirs_ko(self, *args):
# pylint: disable=unused-argument
self.assertEqual(self.tempestcommon.run(),
@@ -199,6 +195,8 @@ class OSTempestTesting(unittest.TestCase):
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.os.makedirs')
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
'TempestResourcesManager.create', side_effect=Exception)
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'TempestResourcesManager.cleanup')
def test_run_create_resources_ko(self, *args):
# pylint: disable=unused-argument
self.assertEqual(self.tempestcommon.run(),
@@ -209,20 +207,8 @@ class OSTempestTesting(unittest.TestCase):
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.os.makedirs')
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
'TempestResourcesManager.create', return_value={})
- @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_utils.'
- 'get_active_compute_cnt', side_effect=Exception)
- def test_run_get_active_comp_cnt_ko(self, *args):
- # pylint: disable=unused-argument
- self.assertEqual(self.tempestcommon.run(),
- testcase.TestCase.EX_RUN_ERROR)
-
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.path.exists', return_value=False)
- @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.os.makedirs')
- @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'TempestResourcesManager.create', return_value={})
- @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_utils.'
- 'get_active_compute_cnt', return_value=2)
+ 'TempestResourcesManager.cleanup')
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
'TempestCommon.configure', side_effect=Exception)
def test_run_configure_tempest_ko(self, *args):
@@ -235,8 +221,8 @@ class OSTempestTesting(unittest.TestCase):
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.os.makedirs')
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
'TempestResourcesManager.create', return_value={})
- @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_utils.'
- 'get_active_compute_cnt', return_value=2)
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'TempestResourcesManager.cleanup')
@mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
'TempestCommon.configure')
def _test_run(self, status, *args):