summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorMatthew Treinish <treinish@linux.vnet.ibm.com>2012-12-20 11:56:04 -0500
committerMatthew Treinish <treinish@linux.vnet.ibm.com>2012-12-20 15:45:45 -0500
commitce9867b3facc90defcc17ce3399d410fbaba95d3 (patch)
tree851d878ad82b30f74fb343cfd872b7045ade1943 /nova/tests
parent2655ac9f3cce45d3d3b5f7d38dd8c617ed1de070 (diff)
Add html reports to report action in coverage extension.
This makes a few minor cleanups and 2 additions to the coverage extension. First, it adds a new optional field to the report action: 'html'. This will generate an html report instead of either the text or xml reports that the extension can generate. The second change is that it adds a return for the stop action. Now upon successful completion of the stop action the directory where the coverage data files will be returned. Change-Id: If1aa25fc7237e9bb5100d2a4a8e560f0a68eba61
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/api/openstack/compute/contrib/test_coverage_ext.py4
-rw-r--r--nova/tests/integrated/api_samples/os-coverage/coverage-stop-post-resp.json.tpl3
-rw-r--r--nova/tests/integrated/api_samples/os-coverage/coverage-stop-post-resp.xml.tpl2
-rw-r--r--nova/tests/integrated/test_api_samples.py7
4 files changed, 14 insertions, 2 deletions
diff --git a/nova/tests/api/openstack/compute/contrib/test_coverage_ext.py b/nova/tests/api/openstack/compute/contrib/test_coverage_ext.py
index e7d00e68a..bbbf2160a 100644
--- a/nova/tests/api/openstack/compute/contrib/test_coverage_ext.py
+++ b/nova/tests/api/openstack/compute/contrib/test_coverage_ext.py
@@ -90,6 +90,8 @@ class CoverageExtensionTest(test.TestCase):
res = req.get_response(fakes.wsgi_app(
fake_auth_context=self.admin_context))
self.assertEqual(res.status_int, 200)
+ resp_dict = jsonutils.loads(res.body)
+ self.assertTrue('path' in resp_dict)
def test_report_coverage_action_file(self):
self.stubs.Set(coverage_ext.CoverageController,
@@ -180,7 +182,7 @@ class CoverageExtensionTest(test.TestCase):
self.assertEqual(res.status_int, 404)
def test_report_coverage_action_nostart(self):
- body = {'stop': {}}
+ body = {'report': {}}
req = webob.Request.blank('/v2/fake/os-coverage/action')
req.method = "POST"
req.body = jsonutils.dumps(body)
diff --git a/nova/tests/integrated/api_samples/os-coverage/coverage-stop-post-resp.json.tpl b/nova/tests/integrated/api_samples/os-coverage/coverage-stop-post-resp.json.tpl
new file mode 100644
index 000000000..6cdd1f37d
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-coverage/coverage-stop-post-resp.json.tpl
@@ -0,0 +1,3 @@
+{
+ "path" : "%(path)s"
+}
diff --git a/nova/tests/integrated/api_samples/os-coverage/coverage-stop-post-resp.xml.tpl b/nova/tests/integrated/api_samples/os-coverage/coverage-stop-post-resp.xml.tpl
new file mode 100644
index 000000000..65f5e16bc
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-coverage/coverage-stop-post-resp.xml.tpl
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<path>%(path)s</path>
diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py
index ab6770a23..ece8f321e 100644
--- a/nova/tests/integrated/test_api_samples.py
+++ b/nova/tests/integrated/test_api_samples.py
@@ -753,10 +753,15 @@ class CoverageExtJsonTests(ApiSampleTestBase):
def test_stop_coverage(self):
"""Stop coverage data collection"""
- subs = {}
+ subs = {
+ 'path': '/.*',
+ }
response = self._do_post('os-coverage/action',
'coverage-stop-post-req', subs)
self.assertEqual(response.status, 200)
+ subs.update(self._get_regexes())
+ return self._verify_response('coverage-stop-post-resp',
+ subs, response)
def test_report_coverage(self):
"""Generate a coverage report"""