From 99b87507be5510bc49d5cdb7a2cbd64edbb476af Mon Sep 17 00:00:00 2001 From: Morgan Richomme Date: Thu, 17 Mar 2016 14:54:25 +0100 Subject: 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 --- utils/test/result_collection_api/resources/handlers.py | 10 ++++++++++ utils/test/result_collection_api/resources/models.py | 12 ++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'utils') diff --git a/utils/test/result_collection_api/resources/handlers.py b/utils/test/result_collection_api/resources/handlers.py index 1f4d0bb7b..1eda3b067 100644 --- a/utils/test/result_collection_api/resources/handlers.py +++ b/utils/test/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/utils/test/result_collection_api/resources/models.py b/utils/test/result_collection_api/resources/models.py index 6f9386208..35b6af11f 100644 --- a/utils/test/result_collection_api/resources/models.py +++ b/utils/test/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 } -- cgit 1.2.3-korg