diff options
Diffstat (limited to 'functest/core/testcase.py')
-rw-r--r-- | functest/core/testcase.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/functest/core/testcase.py b/functest/core/testcase.py index f0c6c9e9..e8bb1409 100644 --- a/functest/core/testcase.py +++ b/functest/core/testcase.py @@ -17,6 +17,7 @@ import re import requests from functest.utils import decorators +from functest.utils import env import prettytable @@ -180,14 +181,14 @@ class TestCase(object): assert self.case_name assert self.start_time assert self.stop_time - url = os.environ['TEST_DB_URL'] + url = env.get('TEST_DB_URL') data = {"project_name": self.project_name, "case_name": self.case_name, "details": self.details} - data["installer"] = os.environ['INSTALLER_TYPE'] - data["scenario"] = os.environ['DEPLOY_SCENARIO'] - data["pod_name"] = os.environ['NODE_NAME'] - data["build_tag"] = os.environ['BUILD_TAG'] + data["installer"] = env.get('INSTALLER_TYPE') + data["scenario"] = env.get('DEPLOY_SCENARIO') + data["pod_name"] = env.get('NODE_NAME') + data["build_tag"] = env.get('BUILD_TAG') data["criteria"] = 'PASS' if self.is_successful( ) == TestCase.EX_OK else 'FAIL' data["start_date"] = datetime.fromtimestamp( @@ -197,7 +198,7 @@ class TestCase(object): try: data["version"] = re.search( TestCase._job_name_rule, - os.environ['BUILD_TAG']).group(2) + env.get('BUILD_TAG')).group(2) except Exception: # pylint: disable=broad-except data["version"] = "unknown" req = requests.post( @@ -210,9 +211,6 @@ class TestCase(object): self.__logger.exception( "Please run test before publishing the results") return TestCase.EX_PUSH_TO_DB_ERROR - except KeyError as exc: - self.__logger.error("Please set env var: " + str(exc)) - return TestCase.EX_PUSH_TO_DB_ERROR except requests.exceptions.HTTPError: self.__logger.exception("The HTTP request raises issues") return TestCase.EX_PUSH_TO_DB_ERROR |