summaryrefslogtreecommitdiffstats
path: root/utils/functest_utils.py
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2016-07-29 17:07:44 +0800
committerSerena Feng <feng.xiaowei@zte.com.cn>2016-07-29 09:11:58 +0000
commite9e07888dc8b78653e19745a3214cdd187022746 (patch)
treebbb306f399903bd6e83e3c8e7a26a535a8b43b19 /utils/functest_utils.py
parentc6276aad7b90561fa97d45ea1020b061b7c9ccd1 (diff)
correct rally criteria check
add method check_success_rate() to unify criteria check by success_rate JIRA: FUNCTEST-398 Change-Id: I1b3f0ccd7061b80ac88356206f29844e31e4101b Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils/functest_utils.py')
-rw-r--r--utils/functest_utils.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/utils/functest_utils.py b/utils/functest_utils.py
index a21ac4466..b0014308e 100644
--- a/utils/functest_utils.py
+++ b/utils/functest_utils.py
@@ -347,3 +347,22 @@ def get_parameter_from_yaml(parameter, file=None):
raise ValueError("The parameter %s is not defined in"
" config_functest.yaml" % parameter)
return value
+
+
+def check_success_rate(case_name, success_rate):
+ success_rate = float(success_rate)
+ criteria = get_criteria_by_test(case_name)
+
+ def get_value(op):
+ return float(criteria.split(op)[1].rstrip('%'))
+
+ status = 'FAIL'
+ ops = ['==', '>=']
+ for op in ops:
+ if op in criteria:
+ c_value = get_value(op)
+ if eval("%s %s %s" % (success_rate, op, c_value)):
+ status = 'PASS'
+ break
+
+ return status