diff options
author | 2017-11-23 08:55:04 +0000 | |
---|---|---|
committer | 2017-11-23 08:55:04 +0000 | |
commit | 71ba783c1279370af035ff7cac2de7522e95de78 (patch) | |
tree | e5d60fb97657c9204d7f749d059f26530d9594cb /functest/api/resources/v1/testcases.py | |
parent | 01a5192428eb99afcb94047e6faa54e1d57114d1 (diff) | |
parent | d4996440fa16297aee7a925e6357a9cfd42d24f8 (diff) |
Merge "Remove prepare_env"
Diffstat (limited to 'functest/api/resources/v1/testcases.py')
-rw-r--r-- | functest/api/resources/v1/testcases.py | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/functest/api/resources/v1/testcases.py b/functest/api/resources/v1/testcases.py index 7cc70bbc..01571548 100644 --- a/functest/api/resources/v1/testcases.py +++ b/functest/api/resources/v1/testcases.py @@ -115,34 +115,31 @@ class V1Testcase(ApiResource): case_name = args.get('testcase') self._update_logging_ini(args.get('task_id')) - if not os.path.isfile(CONST.__getattribute__('env_active')): - raise Exception("Functest environment is not ready.") + try: + cmd = "run_tests -t {}".format(case_name) + runner = ft_utils.execute_command(cmd) + except Exception: # pylint: disable=broad-except + result = 'FAIL' + LOGGER.exception("Running test case %s failed!", case_name) + if runner == os.EX_OK: + result = 'PASS' else: - try: - cmd = "run_tests -t {}".format(case_name) - runner = ft_utils.execute_command(cmd) - except Exception: # pylint: disable=broad-except - result = 'FAIL' - LOGGER.exception("Running test case %s failed!", case_name) - if runner == os.EX_OK: - result = 'PASS' - else: - result = 'FAIL' - - env_info = { - 'installer': CONST.__getattribute__('INSTALLER_TYPE'), - 'scenario': CONST.__getattribute__('DEPLOY_SCENARIO'), - 'build_tag': CONST.__getattribute__('BUILD_TAG'), - 'ci_loop': CONST.__getattribute__('CI_LOOP') - } - result = { - 'task_id': args.get('task_id'), - 'testcase': case_name, - 'env_info': env_info, - 'result': result - } - - return {'result': result} + result = 'FAIL' + + env_info = { + 'installer': CONST.__getattribute__('INSTALLER_TYPE'), + 'scenario': CONST.__getattribute__('DEPLOY_SCENARIO'), + 'build_tag': CONST.__getattribute__('BUILD_TAG'), + 'ci_loop': CONST.__getattribute__('CI_LOOP') + } + result = { + 'task_id': args.get('task_id'), + 'testcase': case_name, + 'env_info': env_info, + 'result': result + } + + return {'result': result} def _update_logging_ini(self, task_id): # pylint: disable=no-self-use """ Update the log file for each task""" |