summaryrefslogtreecommitdiffstats
path: root/utils/functest_utils.py
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-06-08 15:56:54 +0200
committerMorgan Richomme <morgan.richomme@orange.com>2016-06-08 16:43:47 +0200
commit03fc68820d1badd600832de3b7c6dd72368dd198 (patch)
tree0ece513a5ea3acd1296e299fd1e09a331f80ad03 /utils/functest_utils.py
parent4c971bff1c2e4665bbf389f84acfa4d2c81f9b55 (diff)
Adapt functest testcase to APi refactoring
JIRA: FUNCTEST-303 Change-Id: Ia276d9ca6e8d62b496c3b5f81561b14b02c43fd7 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
Diffstat (limited to 'utils/functest_utils.py')
-rw-r--r--utils/functest_utils.py30
1 files changed, 24 insertions, 6 deletions
diff --git a/utils/functest_utils.py b/utils/functest_utils.py
index b43a63cb8..7b6824423 100644
--- a/utils/functest_utils.py
+++ b/utils/functest_utils.py
@@ -149,17 +149,35 @@ def get_build_tag(logger=None):
return build_tag
-def push_results_to_db(db_url, project, case_name, logger, pod_name,
- version, scenario, criteria, build_tag, payload):
+def get_db_url(logger=None):
+ """
+ Returns DB URL
+ """
+ with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f:
+ functest_yaml = yaml.safe_load(f)
+ f.close()
+ db_url = functest_yaml.get("results").get("test_db_url")
+ return db_url
+
+
+def push_results_to_db(project, case_name, logger,
+ start_date, stop_date, criteria, details):
"""
POST results to the Result target DB
"""
- url = db_url + "/results"
+ # 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)
+
params = {"project_name": project, "case_name": case_name,
"pod_name": pod_name, "installer": installer,
"version": version, "scenario": scenario, "criteria": criteria,
- "build_tag": build_tag, "details": payload}
+ "build_tag": build_tag, "start_date": start_date,
+ "stop_date": stop_date, "details": details}
headers = {'Content-Type': 'application/json'}
try:
@@ -170,8 +188,8 @@ def push_results_to_db(db_url, project, case_name, logger, pod_name,
except Exception, e:
print ("Error [push_results_to_db('%s', '%s', '%s', " +
"'%s', '%s', '%s', '%s', '%s', '%s')]:" %
- (db_url, project, case_name, pod_name, version,
- scenario, criteria, build_tag, payload)), e
+ (url, project, case_name, pod_name, version,
+ scenario, criteria, build_tag, details)), e
return False