diff options
author | Morgan Richomme <morgan.richomme@orange.com> | 2016-04-29 14:10:36 +0200 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2016-04-29 14:10:36 +0200 |
commit | 1608960c0d06824e15cb26e95ece2d3936bf748f (patch) | |
tree | 88f2e46f7296482a0a01fd7efc74cf93dc05ad65 /utils/test | |
parent | 6e6b84522797ffad0d9342bd45b78246528a4e8e (diff) |
Add trust indicator field
JIRA: FUNCTEST-165
Change-Id: Ic79f528f27dd28b6781ddd3300743ba691a8c085
Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
Diffstat (limited to 'utils/test')
-rw-r--r-- | utils/test/result_collection_api/resources/handlers.py | 6 | ||||
-rw-r--r-- | utils/test/result_collection_api/resources/models.py | 24 |
2 files changed, 26 insertions, 4 deletions
diff --git a/utils/test/result_collection_api/resources/handlers.py b/utils/test/result_collection_api/resources/handlers.py index 1eda3b067..c1e8eb182 100644 --- a/utils/test/result_collection_api/resources/handlers.py +++ b/utils/test/result_collection_api/resources/handlers.py @@ -512,6 +512,8 @@ class TestResultsHandler(GenericApiHandler): - period : x (x last days) - scenario : the test scenario (previously version) - criteria : the global criteria status passed or failed + - trust_indicator : evaluate the stability of the test case to avoid + running systematically long and stable test case :param result_id: Get a result by ID @@ -531,6 +533,7 @@ class TestResultsHandler(GenericApiHandler): scenario_arg = self.get_query_argument("scenario", None) criteria_arg = self.get_query_argument("criteria", None) period_arg = self.get_query_argument("period", None) + trust_indicator_arg = self.get_query_argument("trust_indicator", None) # prepare request get_request = dict() @@ -559,6 +562,9 @@ class TestResultsHandler(GenericApiHandler): if criteria_arg is not None: get_request["criteria_tag"] = criteria_arg + if trust_indicator_arg is not None: + get_request["trust_indicator_arg"] = trust_indicator_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 35b6af11f..06e95f94f 100644 --- a/utils/test/result_collection_api/resources/models.py +++ b/utils/test/result_collection_api/resources/models.py @@ -153,6 +153,7 @@ class TestResult: self.build_tag = None
self.scenario = None
self.criteria = None
+ self.trust_indicator = None
@staticmethod
def test_result_from_dict(test_result_dict):
@@ -173,7 +174,21 @@ class TestResult: t.build_tag = test_result_dict.get('build_tag')
t.scenario = test_result_dict.get('scenario')
t.criteria = test_result_dict.get('criteria')
-
+ # 0 < trust indicator < 1
+ # if bad value => set this indicator to 0
+ if test_result_dict.get('trust_indicator') is not None:
+ if isinstance(test_result_dict.get('trust_indicator'),
+ (int, long, float)):
+ if test_result_dict.get('trust_indicator') < 0:
+ t.trust_indicator = 0
+ elif test_result_dict.get('trust_indicator') > 1:
+ t.trust_indicator = 1
+ else:
+ t.trust_indicator = test_result_dict.get('trust_indicator')
+ else:
+ t.trust_indicator = 0
+ else:
+ t.trust_indicator = 0
return t
def format(self):
@@ -188,7 +203,8 @@ class TestResult: "details": self.details,
"build_tag": self.build_tag,
"scenario": self.scenario,
- "criteria": self.criteria
+ "criteria": self.criteria,
+ "trust_indicator": self.trust_indicator
}
def format_http(self):
@@ -204,6 +220,6 @@ class TestResult: "details": self.details,
"build_tag": self.build_tag,
"scenario": self.scenario,
- "criteria": self.criteria
+ "criteria": self.criteria,
+ "trust_indicator": self.trust_indicator
}
-
|