summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xci/daily.sh6
-rw-r--r--storperf/db/job_db.py12
-rw-r--r--storperf/db/test_results_db.py4
-rw-r--r--storperf/test_executor.py5
-rw-r--r--storperf/utilities/data_handler.py30
-rw-r--r--tests/utilities_tests/data_handler_test.py7
6 files changed, 42 insertions, 22 deletions
diff --git a/ci/daily.sh b/ci/daily.sh
index b31f8e6..1e01cb8 100755
--- a/ci/daily.sh
+++ b/ci/daily.sh
@@ -90,7 +90,6 @@ do
| awk '/Status/ {print $2}' | cut -d\" -f2`
done
-
echo ==========================================================================
echo Starting full matrix run
echo ==========================================================================
@@ -112,9 +111,14 @@ do
| awk '/Status/ {print $2}' | cut -d\" -f2`
done
+HREF=`curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=status" \
+ | awk '/TestResultURL/ {print $2}' | cut -d\" -f2 | cut -d/ -f4-`
+
echo "Deleting stack for cleanup"
curl -X DELETE --header 'Accept: application/json' 'http://127.0.0.1:5000/api/v1.0/configurations'
sudo chmod 777 -R $WORKSPACE/ci/job/carbon
+echo "Results published to: http://testresults.opnfv.org/test/$HREF"
+
exit 0
diff --git a/storperf/db/job_db.py b/storperf/db/job_db.py
index 3d66be8..05160ec 100644
--- a/storperf/db/job_db.py
+++ b/storperf/db/job_db.py
@@ -7,11 +7,11 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-from sqlite3 import OperationalError
-from threading import Lock
import calendar
import logging
+from sqlite3 import OperationalError
import sqlite3
+from threading import Lock
import time
import uuid
@@ -54,6 +54,14 @@ class JobDB(object):
except OperationalError:
self.logger.debug("Job params table exists")
+ try:
+ cursor.execute('''CREATE TABLE job_summary
+ (job_id text,
+ summary text)''')
+ self.logger.debug("Created job table")
+ except OperationalError:
+ self.logger.debug("Job table exists")
+
cursor.execute('SELECT * FROM jobs')
cursor.execute('SELECT * FROM job_params')
db.commit()
diff --git a/storperf/db/test_results_db.py b/storperf/db/test_results_db.py
index 038525f..a2f7038 100644
--- a/storperf/db/test_results_db.py
+++ b/storperf/db/test_results_db.py
@@ -52,10 +52,10 @@ def push_results_to_db(db_url, project, case_name,
logger.debug(r)
logger.debug(r.status_code)
logger.debug(r.content)
- return True
+ return json.loads(r.content)
except Exception, e:
logger.error("Error [push_results_to_db('%s', '%s', '%s', " +
"'%s', '%s', '%s', '%s', '%s', '%s')]:" %
(db_url, project, case_name, pod_name, version,
scenario, criteria, build_tag, details), e)
- return False
+ return None
diff --git a/storperf/test_executor.py b/storperf/test_executor.py
index e6f0784..d46e0c7 100644
--- a/storperf/test_executor.py
+++ b/storperf/test_executor.py
@@ -43,6 +43,7 @@ class TestExecutor(object):
self.end_time = None
self.current_workload = None
self.workload_status = {}
+ self.result_url = None
self._queue_depths = [1, 4, 8]
self._block_sizes = [512, 4096, 16384]
self.event_listeners = set()
@@ -198,6 +199,7 @@ class TestExecutor(object):
result['Status'] = status
result['Workloads'] = self.workload_status
+ result['TestResultURL'] = self.result_url
return result
@@ -303,6 +305,9 @@ class TestExecutor(object):
self.logger.info("Completed workload %s" % (workload_name))
self.logger.info("Completed job %s" % (self.job_db.job_id))
+ if self.result_url is not None:
+ self.logger.info("Results can be found at %s" % self.result_url)
+
self.end_time = time.time()
self._terminated = True
self.broadcast_event()
diff --git a/storperf/utilities/data_handler.py b/storperf/utilities/data_handler.py
index 78708b5..b62d37b 100644
--- a/storperf/utilities/data_handler.py
+++ b/storperf/utilities/data_handler.py
@@ -9,14 +9,15 @@
import logging
import os
+from time import sleep
+import time
+
from storperf.db import test_results_db
from storperf.db.graphite_db import GraphiteDB
from storperf.utilities import data_treatment as DataTreatment
from storperf.utilities import dictionary
from storperf.utilities import math as math
from storperf.utilities import steady_state as SteadyState
-from time import sleep
-import time
class DataHandler(object):
@@ -167,17 +168,18 @@ class DataHandler(object):
if test_db is not None:
self.logger.info("Pushing results to %s" % (test_db))
try:
- test_results_db.push_results_to_db(test_db,
- "storperf",
- test_case,
- start_time,
- end_time,
- self.logger,
- pod_name,
- version,
- scenario,
- criteria,
- build_tag,
- payload)
+ response = test_results_db.push_results_to_db(test_db,
+ "storperf",
+ test_case,
+ start_time,
+ end_time,
+ self.logger,
+ pod_name,
+ version,
+ scenario,
+ criteria,
+ build_tag,
+ payload)
+ executor.result_url = response['href']
except:
self.logger.exception("Error pushing results into Database")
diff --git a/tests/utilities_tests/data_handler_test.py b/tests/utilities_tests/data_handler_test.py
index 7963c9f..90df0f6 100644
--- a/tests/utilities_tests/data_handler_test.py
+++ b/tests/utilities_tests/data_handler_test.py
@@ -8,11 +8,12 @@
##############################################################################
import os
-from storperf.utilities.data_handler import DataHandler
import unittest
import mock
+from storperf.utilities.data_handler import DataHandler
+
class MockGraphiteDB(object):
@@ -54,7 +55,8 @@ class DataHandlerTest(unittest.TestCase):
def push_results_to_db(self, *args):
self.pushed = True
self.db_results = args
- pass
+ results = {"href": "http://localhost/api/result/uuid-that-is-long"}
+ return results
def terminate(self):
self._terminated = True
@@ -283,4 +285,3 @@ class DataHandlerTest(unittest.TestCase):
'Start time')
self.assertEqual('2017-09-04 21:20:00', self.db_results[4],
'End time')
-