diff options
author | Cedric Ollivier <cedric.ollivier@orange.com> | 2017-08-28 19:47:15 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-08-28 19:47:15 +0000 |
commit | ba459114a5dfd1efe5e817fdc8a172bfb4dc0a3e (patch) | |
tree | 8a8fc33d077f97143e9a9f378280a15c38a63c7e /functest | |
parent | 71e287712d1f59e442603af244ff3230a6333e44 (diff) | |
parent | 9cd065bd3ce2544ced1ace605da0d77c1b59cb3b (diff) |
Merge "Obtain scenario by CONST instead of get function"
Diffstat (limited to 'functest')
-rw-r--r-- | functest/opnfv_tests/openstack/snaps/snaps_test_runner.py | 3 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/tempest.py | 4 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/vping/vping_base.py | 3 | ||||
-rw-r--r-- | functest/tests/unit/utils/test_functest_utils.py | 26 | ||||
-rw-r--r-- | functest/utils/functest_utils.py | 16 |
5 files changed, 8 insertions, 44 deletions
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py index 19c6a87f..bfdcd862 100644 --- a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py +++ b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py @@ -10,7 +10,6 @@ import logging from functest.core import unit from functest.opnfv_tests.openstack.snaps import snaps_utils -from functest.utils import functest_utils from functest.utils.constants import CONST from snaps.openstack import create_flavor @@ -44,7 +43,7 @@ class SnapsTestRunner(unit.Suite): self.use_fip = CONST.__getattribute__('snaps_use_floating_ips') self.use_keystone = CONST.__getattribute__('snaps_use_keystone') - scenario = functest_utils.get_scenario() + scenario = CONST.__getattribute__('DEPLOY_SCENARIO') self.flavor_metadata = None if 'ovs' in scenario or 'fdio' in scenario: diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index 6523dfca..b8a4e9ad 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -445,7 +445,7 @@ class TempestResourcesManager(object): if (CONST.__getattribute__('tempest_use_custom_flavors') or use_custom_flavors): logger.info("Creating flavor for Tempest suite") - scenario = ft_utils.get_scenario() + scenario = CONST.__getattribute__('DEPLOY_SCENARIO') flavor_metadata = None if 'ovs' in scenario or 'fdio' in scenario: flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE @@ -464,7 +464,7 @@ class TempestResourcesManager(object): if use_custom_flavors: logger.info("Creating 2nd flavor for Tempest suite") - scenario = ft_utils.get_scenario() + scenario = CONST.__getattribute__('DEPLOY_SCENARIO') flavor_metadata_alt = None if 'ovs' in scenario or 'fdio' in scenario: flavor_metadata_alt = create_flavor.MEM_PAGE_SIZE_LARGE diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py index 6e908065..c93d2f26 100644 --- a/functest/opnfv_tests/openstack/vping/vping_base.py +++ b/functest/opnfv_tests/openstack/vping/vping_base.py @@ -13,7 +13,6 @@ import time import uuid from functest.core import testcase -from functest.utils import functest_utils from functest.utils.constants import CONST from snaps.openstack import create_flavor @@ -139,7 +138,7 @@ class VPingBase(testcase.TestCase): self.logger.info( "Creating flavor with name: '%s'" % self.flavor_name) - scenario = functest_utils.get_scenario() + scenario = CONST.__getattribute__('DEPLOY_SCENARIO') flavor_metadata = None if 'ovs' in scenario or 'fdio' in scenario: flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE diff --git a/functest/tests/unit/utils/test_functest_utils.py b/functest/tests/unit/utils/test_functest_utils.py index cd3693c7..d67f4135 100644 --- a/functest/tests/unit/utils/test_functest_utils.py +++ b/functest/tests/unit/utils/test_functest_utils.py @@ -114,25 +114,6 @@ class FunctestUtilsTesting(unittest.TestCase): self.assertEqual(functest_utils.get_installer_type(), self.installer) - @mock.patch('functest.utils.functest_utils.logger.info') - def test_get_scenario_failed(self, mock_logger_info): - with mock.patch.dict(os.environ, - {}, - clear=True): - self.assertEqual(functest_utils.get_scenario(), - "os-nosdn-nofeature-noha") - mock_logger_info.assert_called_once_with("Impossible to retrieve " - "the scenario.Use " - "default " - "os-nosdn-nofeature-noha") - - def test_get_scenario_default(self): - with mock.patch.dict(os.environ, - {'DEPLOY_SCENARIO': 'test_scenario'}, - clear=True): - self.assertEqual(functest_utils.get_scenario(), - self.scenario) - def test_get_version_daily_job(self): CONST.__setattr__('BUILD_TAG', self.build_tag) self.assertEqual(functest_utils.get_version(), self.version) @@ -154,10 +135,9 @@ class FunctestUtilsTesting(unittest.TestCase): CONST.__setattr__('results_test_db_url', self.db_url) CONST.__setattr__('BUILD_TAG', self.build_tag) CONST.__setattr__('NODE_NAME', self.node_name) - with mock.patch('functest.utils.functest_utils.get_scenario', - return_value=self.scenario), \ - mock.patch('functest.utils.functest_utils.get_version', - return_value=self.version): + CONST.__setattr__('DEPLOY_SCENARIO', self.scenario) + with mock.patch('functest.utils.functest_utils.get_version', + return_value=self.version): functest_utils.logger_test_results(self.project, self.case_name, self.status, self.details) mock_logger_info.assert_called_once_with( diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py index 5bf3adb6..a7c61ce1 100644 --- a/functest/utils/functest_utils.py +++ b/functest/utils/functest_utils.py @@ -81,20 +81,6 @@ def get_installer_type(): return installer -def get_scenario(): - """ - Get scenario - """ - try: - scenario = os.environ['DEPLOY_SCENARIO'] - except KeyError: - logger.info("Impossible to retrieve the scenario." - "Use default os-nosdn-nofeature-noha") - scenario = "os-nosdn-nofeature-noha" - - return scenario - - def get_version(): """ Get version @@ -122,7 +108,7 @@ def logger_test_results(project, case_name, status, details): Format test case results for the logger """ pod_name = CONST.__getattribute__('NODE_NAME') - scenario = get_scenario() + scenario = CONST.__getattribute__('DEPLOY_SCENARIO') version = get_version() build_tag = CONST.__getattribute__('BUILD_TAG') db_url = CONST.__getattribute__("results_test_db_url") |