summaryrefslogtreecommitdiffstats
path: root/docker/storperf-master
diff options
context:
space:
mode:
authorMark Beierl <mark.beierl@dell.com>2017-09-28 15:37:01 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-09-28 15:37:01 +0000
commit41ba13aad1a57fe9b9bcc674cbfe3215e295f177 (patch)
tree82f20071021ef876d9ff7735f6cb028980484844 /docker/storperf-master
parentf38586641a6528fd0165c1146a164622853b6ac9 (diff)
parent01bad48306bfa00f234dd09ab30a05e9b35b01b2 (diff)
Merge "Fix Test Results"
Diffstat (limited to 'docker/storperf-master')
-rw-r--r--docker/storperf-master/storperf/db/test_results_db.py11
-rw-r--r--docker/storperf-master/storperf/utilities/data_handler.py20
-rw-r--r--docker/storperf-master/tests/utilities_tests/data_handler_test.py29
3 files changed, 47 insertions, 13 deletions
diff --git a/docker/storperf-master/storperf/db/test_results_db.py b/docker/storperf-master/storperf/db/test_results_db.py
index 9c87e32..8e9c5ef 100644
--- a/docker/storperf-master/storperf/db/test_results_db.py
+++ b/docker/storperf-master/storperf/db/test_results_db.py
@@ -17,10 +17,10 @@ def push_results_to_db(db_url, details, logger):
"""
url = db_url + "/results"
- params = details.copy()
- params.pop('details')
+ params = details["report"]
- logger.info("popped params= %s" % params)
+ if logger:
+ logger.info("popped params= %s" % params)
headers = {'Content-Type': 'application/json'}
try:
@@ -35,6 +35,7 @@ def push_results_to_db(db_url, details, logger):
logger.debug(r.content)
return json.loads(r.content)
except Exception:
- logger.exception("Error [push_results_to_db('%s', '%s')]:" %
- (db_url, params))
+ if logger:
+ logger.exception("Error [push_results_to_db('%s', '%s')]:" %
+ (db_url, params))
return None
diff --git a/docker/storperf-master/storperf/utilities/data_handler.py b/docker/storperf-master/storperf/utilities/data_handler.py
index f5bf387..8a69180 100644
--- a/docker/storperf-master/storperf/utilities/data_handler.py
+++ b/docker/storperf-master/storperf/utilities/data_handler.py
@@ -129,16 +129,9 @@ class DataHandler(object):
def _push_to_db(self, executor):
executor.metadata['duration'] = executor.end_time - executor.start_time
- steady_state = True
- for _, value in executor.metadata['details']['steady_state'].items():
- steady_state = steady_state and value
-
executor.metadata['timestart'] = executor.start_time
- if steady_state:
- criteria = 'PASS'
- else:
- criteria = 'FAIL'
+ criteria = self._determine_criteria(executor.metadata)
executor.metadata['criteria'] = criteria
executor.metadata['start_date'] = \
@@ -160,3 +153,14 @@ class DataHandler(object):
executor.result_url = response['href']
except Exception:
self.logger.exception("Error pushing results into Database")
+
+ def _determine_criteria(self, metadata):
+ steady_state = True
+ for workload, value in metadata['details']['steady_state'].items():
+ if not workload.startswith("_"):
+ steady_state = steady_state and value
+
+ if steady_state:
+ return "PASS"
+ else:
+ return "FAIL"
diff --git a/docker/storperf-master/tests/utilities_tests/data_handler_test.py b/docker/storperf-master/tests/utilities_tests/data_handler_test.py
index d83bf1b..8c7deb5 100644
--- a/docker/storperf-master/tests/utilities_tests/data_handler_test.py
+++ b/docker/storperf-master/tests/utilities_tests/data_handler_test.py
@@ -306,3 +306,32 @@ class DataHandlerTest(unittest.TestCase):
self.assertEqual('2017-09-04 21:20:00',
self.db_results[1]['stop_date'],
'End time')
+
+ def test_pass_criteria(self):
+ metadata = {
+ "details": {
+ "steady_state": {
+ "_warm_up.queue-depth.8.block-size.16384": False,
+ "rw.queue-depth.4.block-size.16384": True
+ }
+ },
+ }
+ criteria = self.data_handler._determine_criteria(metadata)
+ self.assertEqual('PASS',
+ criteria,
+ 'PASS')
+
+ def test_fail_criteria(self):
+ metadata = {
+ "details": {
+ "steady_state": {
+ "_warm_up.queue-depth.8.block-size.16384": False,
+ "rw.queue-depth.4.block-size.16384": True,
+ "rw.queue-depth.8.block-size.16384": False
+ }
+ },
+ }
+ criteria = self.data_handler._determine_criteria(metadata)
+ self.assertEqual('FAIL',
+ criteria,
+ 'FAIL')