aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-04-22 11:18:36 +0200
committerMorgan Richomme <morgan.richomme@orange.com>2016-04-22 13:55:19 +0200
commitade54b8ec63fc674cfd7d7e0a893b7e34f6b44b1 (patch)
tree6e3cd547ecba1cb1ab3a9d90ad08209291b49cc9
parente452376fbc44df9cf0688571e1882498f456f3a4 (diff)
Affect version field in results for all the testcases
Previously version was scenario JIRA: FUNCTEST-225 Change-Id: Ia86f83dbe98ad5f9dbced60c46e57f58eccba7e9 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
-rw-r--r--testcases/Controllers/ODL/CI/odlreport2db.py2
-rw-r--r--testcases/Controllers/ONOS/Teston/CI/onosfunctest.py2
-rwxr-xr-xtestcases/VIM/OpenStack/CI/libraries/run_rally-cert.py3
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/run_tempest.py3
-rw-r--r--testcases/features/doctor.py2
-rw-r--r--testcases/features/promise.py3
-rw-r--r--testcases/functest_utils.py16
-rw-r--r--testcases/vIMS/CI/vIMS.py2
-rw-r--r--testcases/vPing/CI/libraries/vPing_ssh.py2
-rw-r--r--testcases/vPing/CI/libraries/vPing_userdata.py2
10 files changed, 24 insertions, 13 deletions
diff --git a/testcases/Controllers/ODL/CI/odlreport2db.py b/testcases/Controllers/ODL/CI/odlreport2db.py
index f236ddcba..983633ad8 100644
--- a/testcases/Controllers/ODL/CI/odlreport2db.py
+++ b/testcases/Controllers/ODL/CI/odlreport2db.py
@@ -129,7 +129,7 @@ def main(argv):
# -i fuel
# -p opnfv-jump-2
# -s os-odl_l2-ha
- version = scenario
+ version = functest_utils.get_version()
# success criteria for ODL = 100% of tests OK
status = "failed"
diff --git a/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py b/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py
index d36cf5edd..8186e7da6 100644
--- a/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py
+++ b/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py
@@ -189,7 +189,7 @@ def main():
logger.debug("Push result into DB")
# TODO check path result for the file
scenario = functest_utils.get_scenario(logger)
- version = scenario
+ version = functest_utils.get_version(logger)
result = GetResult()
# ONOS success criteria = all tests OK
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
index 6e625ce51..41c359cc7 100755
--- a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
@@ -136,8 +136,7 @@ def push_results_to_db(case, payload, criteria):
url = TEST_DB + "/results"
installer = functest_utils.get_installer_type(logger)
scenario = functest_utils.get_scenario(logger)
- # Until we found a way to manage version, use scenario
- version = scenario
+ version = functest_utils.get_version(logger)
pod_name = functest_utils.get_pod_name(logger)
# evalutate success criteria
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
index 9d8b7be8b..b2240c9c2 100644
--- a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
@@ -129,13 +129,14 @@ def push_results_to_db(case, payload, criteria):
url = TEST_DB + "/results"
installer = functest_utils.get_installer_type(logger)
scenario = functest_utils.get_scenario(logger)
+ version = functest_utils.get_version(logger)
pod_name = functest_utils.get_pod_name(logger)
logger.info("Pushing results to DB: '%s'." % url)
params = {"project_name": "functest", "case_name": case,
"pod_name": str(pod_name), 'installer': installer,
- "version": scenario, "scenario": scenario, "criteria": criteria,
+ "version": version, "scenario": scenario, "criteria": criteria,
'details': payload}
headers = {'Content-Type': 'application/json'}
diff --git a/testcases/features/doctor.py b/testcases/features/doctor.py
index 9ca6bf618..978750b2d 100644
--- a/testcases/features/doctor.py
+++ b/testcases/features/doctor.py
@@ -60,7 +60,7 @@ def main():
}
pod_name = functest_utils.get_pod_name(logger)
scenario = functest_utils.get_scenario(logger)
- version = scenario
+ version = functest_utils.get_version(logger)
build_tag = functest_utils.get_build_tag(logger)
status = "failed"
diff --git a/testcases/features/promise.py b/testcases/features/promise.py
index 04ca87a70..72c5ecb3f 100644
--- a/testcases/features/promise.py
+++ b/testcases/features/promise.py
@@ -244,6 +244,7 @@ def main():
pod_name = functest_utils.get_pod_name(logger)
installer = functest_utils.get_installer_type(logger)
scenario = functest_utils.get_scenario(logger)
+ version = functest_utils.get_version(logger)
build_tag = functest_utils.get_build_tag(logger)
# git_version = functest_utils.get_git_branch(PROMISE_REPO)
url = TEST_DB + "/results"
@@ -259,7 +260,7 @@ def main():
params = {"project_name": "promise", "case_name": "promise",
"pod_name": str(pod_name), 'installer': installer,
- "version": scenario, "scenario": scenario,
+ "version": version, "scenario": scenario,
"criteria": status, "build_tag": build_tag,
'details': json_results}
headers = {'Content-Type': 'application/json'}
diff --git a/testcases/functest_utils.py b/testcases/functest_utils.py
index 1fccdca8d..ded740e0d 100644
--- a/testcases/functest_utils.py
+++ b/testcases/functest_utils.py
@@ -98,9 +98,19 @@ def get_version(logger=None):
"""
Get version
"""
- # TODO
-
- return ""
+ # Use the build tag to retrieve the version
+ # By default version is unknown
+ # if launched through CI the build tag has the following format
+ # jenkins-<project>-<installer>-<pod>-<job>-<branch>-<id>
+ # e.g. jenkins-functest-fuel-opnfv-jump-2-daily-master-190
+ # use regex to match branch info
+ rule = "daily-(.+?)-[0-9]*"
+ build_tag = get_build_tag(logger)
+ m = re.search(rule, build_tag)
+ if m:
+ return m.group(1)
+ else:
+ return "unknown"
def get_pod_name(logger=None):
diff --git a/testcases/vIMS/CI/vIMS.py b/testcases/vIMS/CI/vIMS.py
index fcc056357..555015838 100644
--- a/testcases/vIMS/CI/vIMS.py
+++ b/testcases/vIMS/CI/vIMS.py
@@ -136,7 +136,7 @@ def push_results(status):
logger.debug("Pushing results to DB....")
scenario = functest_utils.get_scenario(logger)
- version = scenario
+ version = functest_utils.get_version(logger)
pod_name = functest_utils.get_pod_name(logger)
build_tag = functest_utils.get_build_tag(logger)
diff --git a/testcases/vPing/CI/libraries/vPing_ssh.py b/testcases/vPing/CI/libraries/vPing_ssh.py
index 3d2ff7084..f7e9884ee 100644
--- a/testcases/vPing/CI/libraries/vPing_ssh.py
+++ b/testcases/vPing/CI/libraries/vPing_ssh.py
@@ -258,7 +258,7 @@ def push_results(start_time_ts, duration, test_status):
try:
logger.debug("Pushing result into DB...")
scenario = functest_utils.get_scenario(logger)
- version = scenario
+ version = functest_utils.get_version(logger)
criteria = "failed"
if test_status == "OK":
criteria = "passed"
diff --git a/testcases/vPing/CI/libraries/vPing_userdata.py b/testcases/vPing/CI/libraries/vPing_userdata.py
index 0adfc6dbd..798cf1c63 100644
--- a/testcases/vPing/CI/libraries/vPing_userdata.py
+++ b/testcases/vPing/CI/libraries/vPing_userdata.py
@@ -252,7 +252,7 @@ def push_results(start_time_ts, duration, test_status):
try:
logger.debug("Pushing result into DB...")
scenario = functest_utils.get_scenario(logger)
- version = scenario
+ version = functest_utils.get_version(logger)
criteria = "failed"
if test_status == "OK":
criteria = "passed"