summaryrefslogtreecommitdiffstats
path: root/result_collection_api
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-03-17 14:54:25 +0100
committerMorgan Richomme <morgan.richomme@orange.com>2016-03-17 14:57:38 +0100
commiteae3aa7301f8efffc4da0a7f067de355c336579d (patch)
tree59087ff4ba6ecb1f05396bfe40bb34d23061e512 /result_collection_api
parentec5072c0ccc6648d734226711b43ddb34b2b21af (diff)
Add scenario and criteria field in the Test result object of the test API
scenario will be used for OPNFV scenario (currently using version field) criteria will be passed or failed to give an immediate feedback on the test result status JIRA: FUNCTEST-151 Change-Id: Iff5eb66bbf0cfbaafec0c3a6211031f6eb83c34f Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
Diffstat (limited to 'result_collection_api')
-rw-r--r--result_collection_api/resources/handlers.py10
-rw-r--r--result_collection_api/resources/models.py12
2 files changed, 20 insertions, 2 deletions
diff --git a/result_collection_api/resources/handlers.py b/result_collection_api/resources/handlers.py
index 1f4d0bb..1eda3b0 100644
--- a/result_collection_api/resources/handlers.py
+++ b/result_collection_api/resources/handlers.py
@@ -510,6 +510,8 @@ class TestResultsHandler(GenericApiHandler):
- installer (fuel, ...)
- build_tag : Jenkins build tag name
- period : x (x last days)
+ - scenario : the test scenario (previously version)
+ - criteria : the global criteria status passed or failed
:param result_id: Get a result by ID
@@ -526,6 +528,8 @@ class TestResultsHandler(GenericApiHandler):
version_arg = self.get_query_argument("version", None)
installer_arg = self.get_query_argument("installer", None)
build_tag_arg = self.get_query_argument("build_tag", None)
+ scenario_arg = self.get_query_argument("scenario", None)
+ criteria_arg = self.get_query_argument("criteria", None)
period_arg = self.get_query_argument("period", None)
# prepare request
@@ -549,6 +553,12 @@ class TestResultsHandler(GenericApiHandler):
if build_tag_arg is not None:
get_request["build_tag"] = build_tag_arg
+ if scenario_arg is not None:
+ get_request["scenario"] = scenario_arg
+
+ if criteria_arg is not None:
+ get_request["criteria_tag"] = criteria_arg
+
if period_arg is not None:
try:
period_arg = int(period_arg)
diff --git a/result_collection_api/resources/models.py b/result_collection_api/resources/models.py
index 6f93862..35b6af1 100644
--- a/result_collection_api/resources/models.py
+++ b/result_collection_api/resources/models.py
@@ -151,6 +151,8 @@ class TestResult:
self.creation_date = None
self.details = None
self.build_tag = None
+ self.scenario = None
+ self.criteria = None
@staticmethod
def test_result_from_dict(test_result_dict):
@@ -169,6 +171,8 @@ class TestResult:
t.version = test_result_dict.get('version')
t.installer = test_result_dict.get('installer')
t.build_tag = test_result_dict.get('build_tag')
+ t.scenario = test_result_dict.get('scenario')
+ t.criteria = test_result_dict.get('criteria')
return t
@@ -182,7 +186,9 @@ class TestResult:
"version": self.version,
"installer": self.installer,
"details": self.details,
- "build_tag": self.build_tag
+ "build_tag": self.build_tag,
+ "scenario": self.scenario,
+ "criteria": self.criteria
}
def format_http(self):
@@ -196,6 +202,8 @@ class TestResult:
"version": self.version,
"installer": self.installer,
"details": self.details,
- "build_tag": self.build_tag
+ "build_tag": self.build_tag,
+ "scenario": self.scenario,
+ "criteria": self.criteria
}