aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 f236ddcb..983633ad 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 d36cf5ed..8186e7da 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 6e625ce5..41c359cc 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 9d8b7be8..b2240c9c 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 9ca6bf61..978750b2 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 04ca87a7..72c5ecb3 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 1fccdca8..ded740e0 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 fcc05635..55501583 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 3d2ff708..f7e9884e 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 0adfc6db..798cf1c6 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"