summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric Ollivier <cedric.ollivier@orange.com>2018-03-15 15:25:21 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-03-15 15:25:21 +0000
commita51e1ca848bd3044e928855650eef4dd4bbaced4 (patch)
tree150d5af789e782e76eb47ea38ac6e019fdd0ccb0
parent09e3dedbb5807bc1223553f57a87696f51c83e99 (diff)
parentc9fd7ceab29ff755aa8a9ee1bcb6ab958e5e0420 (diff)
Merge "Create 2 images and flavors for tempest tests"
-rw-r--r--functest/ci/config_patch.yaml8
-rw-r--r--functest/opnfv_tests/openstack/rally/rally.py2
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_test_runner.py8
-rw-r--r--functest/opnfv_tests/openstack/tempest/conf_utils.py23
-rw-r--r--functest/opnfv_tests/openstack/tempest/tempest.py41
-rw-r--r--functest/opnfv_tests/openstack/vping/vping_base.py10
-rw-r--r--functest/tests/unit/openstack/tempest/test_conf_utils.py15
7 files changed, 22 insertions, 85 deletions
diff --git a/functest/ci/config_patch.yaml b/functest/ci/config_patch.yaml
index 32b67057f..dfd441b57 100644
--- a/functest/ci/config_patch.yaml
+++ b/functest/ci/config_patch.yaml
@@ -10,11 +10,11 @@ fdio:
general:
flavor_extra_specs: {'hw:mem_page_size':'large'}
image_properties: {'hw_mem_page_size':'large'}
- tempest:
- use_custom_flavors: 'True'
+ openstack:
+ flavor_ram: 1024
ovs:
general:
flavor_extra_specs: {'hw:mem_page_size':'large'}
image_properties: {'hw_mem_page_size':'large'}
- tempest:
- use_custom_flavors: 'True'
+ openstack:
+ flavor_ram: 1024
diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py
index 1502d5825..5b6a76fe4 100644
--- a/functest/opnfv_tests/openstack/rally/rally.py
+++ b/functest/opnfv_tests/openstack/rally/rally.py
@@ -53,7 +53,7 @@ class RallyBase(testcase.TestCase):
GLANCE_IMAGE_FORMAT = getattr(config.CONF, 'openstack_image_disk_format')
GLANCE_IMAGE_USERNAME = getattr(config.CONF, 'openstack_image_username')
GLANCE_IMAGE_EXTRA_PROPERTIES = getattr(
- config.CONF, 'openstack_extra_properties', {})
+ config.CONF, 'image_properties', {})
FLAVOR_NAME = getattr(config.CONF, 'rally_flavor_name')
FLAVOR_ALT_NAME = getattr(config.CONF, 'rally_flavor_alt_name')
FLAVOR_RAM = 512
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
index c7329f30d..7b111ed1b 100644
--- a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
+++ b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
@@ -12,12 +12,10 @@
import logging
-from snaps.openstack import create_flavor
from xtesting.core import unit
from functest.opnfv_tests.openstack.snaps import snaps_utils
from functest.utils import config
-from functest.utils import env
class SnapsTestRunner(unit.Suite):
@@ -45,12 +43,8 @@ class SnapsTestRunner(unit.Suite):
getattr(config.CONF, 'snaps_use_floating_ips') == 'True')
self.use_keystone = (
getattr(config.CONF, 'snaps_use_keystone') == 'True')
- scenario = env.get('DEPLOY_SCENARIO')
-
- self.flavor_metadata = None
- if 'ovs' in scenario or 'fdio' in scenario:
- self.flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE
+ self.flavor_metadata = getattr(config.CONF, 'flavor_extra_specs', None)
self.logger.info("Using flavor metadata '%s'", self.flavor_metadata)
self.image_metadata = None
diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py
index 8832a48bf..d6b1eb401 100644
--- a/functest/opnfv_tests/openstack/tempest/conf_utils.py
+++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py
@@ -39,9 +39,6 @@ TEMPEST_BLACKLIST = pkg_resources.resource_filename(
'functest', 'opnfv_tests/openstack/tempest/custom_tests/blacklist.txt')
TEMPEST_CONF_YAML = pkg_resources.resource_filename(
'functest', 'opnfv_tests/openstack/tempest/custom_tests/tempest_conf.yaml')
-TEST_ACCOUNTS_FILE = pkg_resources.resource_filename(
- 'functest',
- 'opnfv_tests/openstack/tempest/custom_tests/test_accounts.yaml')
CI_INSTALLER_TYPE = env.get('INSTALLER_TYPE')
@@ -173,26 +170,6 @@ def backup_tempest_config(conf_file, res_dir):
os.path.join(res_dir, 'tempest.conf'))
-def generate_test_accounts_file(tenant_id):
- """
- Add needed tenant and user params into test_accounts.yaml
- """
-
- LOGGER.debug("Add needed params into test_accounts.yaml...")
- accounts_list = [
- {
- 'tenant_name': getattr(
- config.CONF, 'tempest_identity_tenant_name'),
- 'tenant_id': str(tenant_id),
- 'username': getattr(config.CONF, 'tempest_identity_user_name'),
- 'password': getattr(config.CONF, 'tempest_identity_user_password')
- }
- ]
-
- with open(TEST_ACCOUNTS_FILE, "w") as tfile:
- yaml.dump(accounts_list, tfile, default_flow_style=False)
-
-
def update_tempest_conf_file(conf_file, rconfig):
"""Update defined paramters into tempest config file"""
with open(TEMPEST_CONF_YAML) as yfile:
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py
index acab29d85..8d47ddb75 100644
--- a/functest/opnfv_tests/openstack/tempest/tempest.py
+++ b/functest/opnfv_tests/openstack/tempest/tempest.py
@@ -24,7 +24,6 @@ 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 import create_flavor
from snaps.openstack.create_flavor import OpenStackFlavor
from snaps.openstack.tests import openstack_tests
from snaps.openstack.utils import deploy_utils
@@ -435,10 +434,7 @@ class TempestResourcesManager(object):
def _create_flavor(self, name):
"""Create flavor for tests."""
- scenario = env.get('DEPLOY_SCENARIO')
- flavor_metadata = None
- if 'ovs' in scenario or 'fdio' in scenario:
- flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE
+ flavor_metadata = getattr(config.CONF, 'flavor_extra_specs', None)
flavor_creator = OpenStackFlavor(
self.os_creds, FlavorConfig(
name=name,
@@ -452,8 +448,7 @@ class TempestResourcesManager(object):
self.creators.append(flavor_creator)
return flavor.id
- def create(self, use_custom_images=False, use_custom_flavors=False,
- create_project=False):
+ def create(self, create_project=False):
"""Create resources for Tempest test suite."""
result = {
'tempest_net_name': None,
@@ -475,30 +470,20 @@ class TempestResourcesManager(object):
LOGGER.debug("Creating private network for Tempest suite")
result['tempest_net_name'] = self._create_network(project_name)
- LOGGER.debug("Creating image for Tempest suite")
+ 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)
- if use_custom_images:
- LOGGER.debug("Creating 2nd image for Tempest suite")
- image_name = getattr(
- config.CONF, 'openstack_image_name_alt') + self.guid
- result['image_id_alt'] = self._create_image(image_name)
-
- if (getattr(config.CONF, 'tempest_use_custom_flavors') == 'True' or
- use_custom_flavors):
- LOGGER.info("Creating flavor for Tempest suite")
- name = getattr(config.CONF, 'openstack_flavor_name') + self.guid
- result['flavor_id'] = self._create_flavor(name)
-
- if use_custom_flavors:
- LOGGER.info("Creating 2nd flavor for Tempest suite")
- scenario = env.get('DEPLOY_SCENARIO')
- if 'ovs' in scenario or 'fdio' in scenario:
- setattr(config.CONF, 'openstack_flavor_ram', 1024)
- name = getattr(
- config.CONF, 'openstack_flavor_name_alt') + self.guid
- result['flavor_id_alt'] = self._create_flavor(name)
+ 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
diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py
index edc78482b..152f69da6 100644
--- a/functest/opnfv_tests/openstack/vping/vping_base.py
+++ b/functest/opnfv_tests/openstack/vping/vping_base.py
@@ -18,7 +18,6 @@ import uuid
from snaps.config.flavor import FlavorConfig
from snaps.config.network import NetworkConfig, SubnetConfig
from snaps.config.router import RouterConfig
-from snaps.openstack import create_flavor
from snaps.openstack.create_flavor import OpenStackFlavor
from snaps.openstack.tests import openstack_tests
from snaps.openstack.utils import deploy_utils
@@ -144,12 +143,9 @@ class VPingBase(testcase.TestCase):
self.logger.info(
"Creating flavor with name: '%s'", self.flavor_name)
- scenario = env.get('DEPLOY_SCENARIO')
- flavor_metadata = None
- flavor_ram = 512
- if 'ovs' in scenario or 'fdio' in scenario:
- flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE
- flavor_ram = 1024
+ flavor_ram = getattr(config.CONF, 'openstack_flavor_ram')
+ flavor_metadata = getattr(config.CONF, 'flavor_extra_specs', None)
+
flavor_creator = OpenStackFlavor(
self.os_creds,
FlavorConfig(name=self.flavor_name, ram=flavor_ram, disk=1,
diff --git a/functest/tests/unit/openstack/tempest/test_conf_utils.py b/functest/tests/unit/openstack/tempest/test_conf_utils.py
index fa53b57b1..ee22f7fc3 100644
--- a/functest/tests/unit/openstack/tempest/test_conf_utils.py
+++ b/functest/tests/unit/openstack/tempest/test_conf_utils.py
@@ -76,19 +76,11 @@ class OSTempestConfUtilsTesting(unittest.TestCase):
# pylint: disable=unused-argument
tempest_resources = tempest.TempestResourcesManager(
os_creds=self.os_creds)
-
- setattr(config.CONF, 'tempest_use_custom_flavors', 'True')
with self.assertRaises(Exception) as context:
tempest_resources.create()
msg = 'Failed to create flavor'
self.assertTrue(msg in context.exception, msg=str(context.exception))
- setattr(config.CONF, 'tempest_use_custom_flavors', 'False')
- with self.assertRaises(Exception) as context:
- tempest_resources.create(use_custom_flavors=True)
- msg = 'Failed to create flavor'
- self.assertTrue(msg in context.exception, msg=str(context.exception))
-
@staticmethod
@mock.patch('functest.opnfv_tests.openstack.tempest.conf_utils'
'.LOGGER.info')
@@ -233,13 +225,6 @@ class OSTempestConfUtilsTesting(unittest.TestCase):
'test_conf_file', res_dir='test_dir')
self.assertTrue(mock_copyfile.called)
- def test_gen_test_accounts_file_def(self):
- with mock.patch("__builtin__.open", mock.mock_open()), \
- mock.patch('functest.opnfv_tests.openstack.tempest.conf_utils.'
- 'yaml.dump') as mock_dump:
- conf_utils.generate_test_accounts_file('test_tenant_id')
- self.assertTrue(mock_dump.called)
-
def _test_missing_param(self, params, image_id, flavor_id):
with mock.patch('functest.opnfv_tests.openstack.tempest.'
'conf_utils.ConfigParser.RawConfigParser.'