aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2016-08-26 16:53:41 +0200
committerMorgan Richomme <morgan.richomme@orange.com>2016-08-30 07:07:51 +0000
commita13f30f3c81a71b49f9aa1f23d0606ab24eaec93 (patch)
treedc52dd891e11f1385e2303d9913b32c87ebbb570 /utils
parent5881c593a11bcb9b73a8c3189c1cd2a33788be59 (diff)
Set env vars as mandatory to push to DB
Now env vars are mandatory in push_results_to_db. It avoids testing programs to check them even if they are useless from their points of view. The related getters aren't removed to help debugging via logger_test_results which could be run without report. Change-Id: Iadb94319529f5ec4230fb62042511948183b93ed Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit 66334bc798c25d5769f92f2a6292daaf6220da79)
Diffstat (limited to 'utils')
-rw-r--r--utils/functest_utils.py29
1 files changed, 24 insertions, 5 deletions
diff --git a/utils/functest_utils.py b/utils/functest_utils.py
index b916ab129..02e7d3d84 100644
--- a/utils/functest_utils.py
+++ b/utils/functest_utils.py
@@ -200,11 +200,30 @@ def push_results_to_db(project, case_name, logger,
"""
# Retrieve params from CI and conf
url = get_db_url(logger) + "/results"
- installer = get_installer_type(logger)
- scenario = get_scenario(logger)
- version = get_version(logger)
- pod_name = get_pod_name(logger)
- build_tag = get_build_tag(logger)
+
+ try:
+ installer = os.environ['INSTALLER_TYPE']
+ scenario = os.environ['DEPLOY_SCENARIO']
+ pod_name = os.environ['NODE_NAME']
+ build_tag = os.environ['BUILD_TAG']
+ except KeyError as e:
+ msg = "Please set env var: " + str(e)
+ if logger:
+ logger.error(msg)
+ else:
+ print(msg)
+ return False
+ rule = "daily-(.+?)-[0-9]*"
+ m = re.search(rule, build_tag)
+ if m:
+ version = m.group(1)
+ else:
+ msg = "Please fix BUILD_TAG env var: " + build_tag
+ if logger:
+ logger.error(msg)
+ else:
+ print(msg)
+ return False
test_start = dt.fromtimestamp(start_date).strftime('%Y-%m-%d %H:%M:%S')
test_stop = dt.fromtimestamp(stop_date).strftime('%Y-%m-%d %H:%M:%S')