aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthewLi <matthew.lijun@huawei.com>2017-03-29 23:24:05 -0400
committerCédric Ollivier <cedric.ollivier@orange.com>2017-04-04 15:58:28 +0200
commit2f0b1281308cb494d83240eaa5137ca0524718b7 (patch)
tree27f87d84d5ad8e4aaa6e0e946b2e6ba958218546
parentdb9767d6871b3601265b46645d2ff7656f3a0bb4 (diff)
refstack client: improvement and fix of TestCase usage
JIRA: FUNCTEST-772 1, RefstackClientParser should not be a subclass of TestCase 2, tempest_conf.py used for generating reference tempest.conf file not related to functest cmd, use logger is enough Change-Id: If9c37331a5a7687e5704e546efcdea8175b1529c Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
-rwxr-xr-xfunctest/opnfv_tests/openstack/refstack_client/refstack_client.py5
-rwxr-xr-xfunctest/opnfv_tests/openstack/refstack_client/tempest_conf.py19
2 files changed, 11 insertions, 13 deletions
diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
index 2d04869a1..441abfee3 100755
--- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
+++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
@@ -191,10 +191,9 @@ class RefstackClient(testcase.TestCase):
return res
-class RefstackClientParser(testcase.TestCase):
+class RefstackClientParser(object):
- def __init__(self, case_name=''):
- super(RefstackClientParser, self).__init__(case_name)
+ def __init__(self):
self.FUNCTEST_TEST = CONST.dir_functest_test
self.CONF_PATH = CONST.refstack_tempest_conf_path
self.DEFCORE_LIST = CONST.refstack_defcore_list
diff --git a/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py b/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py
index 5624ed79b..d01f08727 100755
--- a/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py
+++ b/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py
@@ -5,9 +5,8 @@
# 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 sys
+import os
-from functest.core import testcase
from functest.opnfv_tests.openstack.tempest import conf_utils
from functest.utils import openstack_utils
from functest.utils.constants import CONST
@@ -25,6 +24,8 @@ class TempestConf(object):
self.DEPLOYMENT_ID = conf_utils.get_verifier_deployment_id()
self.DEPLOYMENT_DIR = conf_utils.get_verifier_deployment_dir(
self.VERIFIER_ID, self.DEPLOYMENT_ID)
+ self.confpath = os.path.join(CONST.dir_functest_test,
+ CONST.refstack_tempest_conf_path)
def generate_tempestconf(self):
try:
@@ -33,21 +34,19 @@ class TempestConf(object):
use_custom_images=True, use_custom_flavors=True)
conf_utils.configure_tempest_defcore(
self.DEPLOYMENT_DIR, img_flavor_dict)
- except KeyError as e:
- logger.error("defcore prepare env error with: %s", e)
+ except Exception as e:
+ logger.error("error with generating refstack client "
+ "reference tempest conf file: %s", e)
def main(self):
try:
self.generate_tempestconf()
- res = testcase.TestCase.EX_OK
+ logger.info("a reference tempest conf file generated "
+ "at %s", self.confpath)
except Exception as e:
logger.error('Error with run: %s', e)
- res = testcase.TestCase.EX_RUN_ERROR
- return res
if __name__ == '__main__':
tempestconf = TempestConf()
- result = tempestconf.main()
- if result != testcase.TestCase.EX_OK:
- sys.exit(result)
+ tempestconf.main()