diff options
author | MatthewLi <matthew.lijun@huawei.com> | 2017-03-25 02:44:00 -0400 |
---|---|---|
committer | MatthewLi <matthew.lijun@huawei.com> | 2017-03-28 05:28:36 -0400 |
commit | 678d5f956b1af373f61f97187ff3e66fdb315654 (patch) | |
tree | 503c211ad6b48d18f5d72f41d16997136e2aa89d /functest/opnfv_tests/openstack/refstack_client/refstack_client.py | |
parent | a14250045fe6fb99bd8a707c59016cba3df4a851 (diff) |
refstack client: manually running improvement
JIRA: FUNCTEST-758
1.python tempest_conf.py can generate a reference tempest.conf under /hom/opnfv/.../refstack_client
this is based on "rally verify configure-verifier"
surely, user can define his/her own tempest.conf by not using this
2.python refstack_client.py -c <tempest_conf_path> --testlist <testlist_file_path>
if not given, will use default path, if file not exists, will have error
Change-Id: I1ceecbe8fe86fbe0d53b736a0f3b9a9ae01f262f
Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
Diffstat (limited to 'functest/opnfv_tests/openstack/refstack_client/refstack_client.py')
-rwxr-xr-x | functest/opnfv_tests/openstack/refstack_client/refstack_client.py | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py index 597ece3e..101bf736 100755 --- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py +++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py @@ -14,10 +14,10 @@ import time 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 import functest.utils.functest_logger as ft_logger import functest.utils.functest_utils as ft_utils +from tempest_conf import TempestConf """ logging configuration """ logger = ft_logger.Logger("refstack_defcore").getLogger() @@ -35,12 +35,6 @@ class RefstackClient(testcase.TestCase): self.CONF_PATH) self.defcorelist = os.path.join(self.FUNCTEST_TEST, self.DEFCORE_LIST) - self.VERIFIER_ID = conf_utils.get_verifier_id() - self.VERIFIER_REPO_DIR = conf_utils.get_verifier_repo_dir( - self.VERIFIER_ID) - self.DEPLOYMENT_ID = conf_utils.get_verifier_deployment_id() - self.DEPLOYMENT_DIR = conf_utils.get_verifier_deployment_dir( - self.VERIFIER_ID, self.DEPLOYMENT_ID) def source_venv(self): @@ -143,28 +137,18 @@ class RefstackClient(testcase.TestCase): logger.info("Testcase %s success_rate is %s%%, is marked as %s" % (self.case_name, success_rate, self.criteria)) - def defcore_env_prepare(self): - try: - img_flavor_dict = conf_utils.create_tempest_resources( - use_custom_images=True, use_custom_flavors=True) - conf_utils.configure_tempest_defcore( - self.DEPLOYMENT_DIR, img_flavor_dict) - self.source_venv() - res = testcase.TestCase.EX_OK - except KeyError as e: - logger.error("defcore prepare env error with: %s", e) - res = testcase.TestCase.EX_RUN_ERROR - - return res - def run(self): + '''used for functest command line, + functest testcase run refstack_defcore''' self.start_time = time.time() if not os.path.exists(conf_utils.REFSTACK_RESULTS_DIR): os.makedirs(conf_utils.REFSTACK_RESULTS_DIR) try: - self.defcore_env_prepare() + tempestconf = TempestConf() + tempestconf.generate_tempestconf() + self.source_venv() self.run_defcore_default() self.parse_refstack_result() res = testcase.TestCase.EX_OK @@ -175,19 +159,32 @@ class RefstackClient(testcase.TestCase): self.stop_time = time.time() return res + def _prep_test(self): + '''Check that the config file exists.''' + if not os.path.isfile(self.confpath): + logger.error("Conf file not valid: %s" % self.confpath) + if not os.path.isfile(self.testlist): + logger.error("testlist file not valid: %s" % self.testlist) + def main(self, **kwargs): + '''used for manually running, + python refstack_client.py -c <tempest_conf_path> + --testlist <testlist_path> + can generate a reference tempest.conf by + python tempest_conf.py + ''' try: - tempestconf = kwargs['config'] - testlist = kwargs['testlist'] + self.confpath = kwargs['config'] + self.testlist = kwargs['testlist'] except KeyError as e: logger.error("Cannot run refstack client. Please check " "%s", e) return self.EX_RUN_ERROR try: - openstack_utils.source_credentials(CONST.openstack_creds) - self.defcore_env_prepare() - self.run_defcore(tempestconf, testlist) - res = testcase.TestCase.EX_OK + self.source_venv() + self._prep_test() + self.run_defcore(self.confpath, self.testlist) + res = testcase.TestcaseBase.EX_OK except Exception as e: logger.error('Error with run: %s', e) res = testcase.TestCase.EX_RUN_ERROR |