summaryrefslogtreecommitdiffstats
path: root/nova/tests/integrated
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2013-03-05 16:17:29 -0500
committerDan Prince <dprince@redhat.com>2013-03-14 15:34:49 -0400
commit37c618da7c565b13cf6779f40c41ce895ff0459f (patch)
tree54dcabba747598aad7f6be14a91a3c88d7d5be86 /nova/tests/integrated
parent9df61c0b06dd81f34d97fbc02030f92928e21a78 (diff)
downloadnova-37c618da7c565b13cf6779f40c41ce895ff0459f.tar.gz
nova-37c618da7c565b13cf6779f40c41ce895ff0459f.tar.xz
nova-37c618da7c565b13cf6779f40c41ce895ff0459f.zip
Make os-services API extensions consistent.
Updates the os-services API extension so that it is consistent internally (index and update return similar formats), and so that it works with the recent novaclient code which sends the following request body format: {"binary": "nova-cert", "host": "nova1"} Also, updates the response body format of the update call so that it wraps things in an extra service dict which should make novaclient happier here as well (and is consistent with other extensions too). Fixes LP Bug #1147746. Change-Id: I932160d64fdd3aaeb2ed90a092ecc7a36dcc9665
Diffstat (limited to 'nova/tests/integrated')
-rw-r--r--nova/tests/integrated/api_samples/os-services/service-disable-put-req.json.tpl2
-rw-r--r--nova/tests/integrated/api_samples/os-services/service-disable-put-resp.json.tpl8
-rw-r--r--nova/tests/integrated/api_samples/os-services/service-enable-put-req.json.tpl2
-rw-r--r--nova/tests/integrated/api_samples/os-services/service-enable-put-resp.json.tpl9
-rw-r--r--nova/tests/integrated/test_api_samples.py12
5 files changed, 19 insertions, 14 deletions
diff --git a/nova/tests/integrated/api_samples/os-services/service-disable-put-req.json.tpl b/nova/tests/integrated/api_samples/os-services/service-disable-put-req.json.tpl
index 4d48af1b8..57182e935 100644
--- a/nova/tests/integrated/api_samples/os-services/service-disable-put-req.json.tpl
+++ b/nova/tests/integrated/api_samples/os-services/service-disable-put-req.json.tpl
@@ -1,4 +1,4 @@
{
"host": "%(host)s",
- "service": "%(service)s"
+ "binary": "%(binary)s"
}
diff --git a/nova/tests/integrated/api_samples/os-services/service-disable-put-resp.json.tpl b/nova/tests/integrated/api_samples/os-services/service-disable-put-resp.json.tpl
index 8219a43f6..47a8b3d81 100644
--- a/nova/tests/integrated/api_samples/os-services/service-disable-put-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/os-services/service-disable-put-resp.json.tpl
@@ -1,5 +1,7 @@
{
- "disabled": true,
- "host": "%(host)s",
- "service": "%(service)s"
+ "service": {
+ "host": "%(host)s",
+ "binary": "%(binary)s",
+ "status": "disabled"
+ }
}
diff --git a/nova/tests/integrated/api_samples/os-services/service-enable-put-req.json.tpl b/nova/tests/integrated/api_samples/os-services/service-enable-put-req.json.tpl
index 4d48af1b8..57182e935 100644
--- a/nova/tests/integrated/api_samples/os-services/service-enable-put-req.json.tpl
+++ b/nova/tests/integrated/api_samples/os-services/service-enable-put-req.json.tpl
@@ -1,4 +1,4 @@
{
"host": "%(host)s",
- "service": "%(service)s"
+ "binary": "%(binary)s"
}
diff --git a/nova/tests/integrated/api_samples/os-services/service-enable-put-resp.json.tpl b/nova/tests/integrated/api_samples/os-services/service-enable-put-resp.json.tpl
index 079b9c76e..24f72311d 100644
--- a/nova/tests/integrated/api_samples/os-services/service-enable-put-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/os-services/service-enable-put-resp.json.tpl
@@ -1,5 +1,8 @@
{
- "disabled": false,
- "host": "%(host)s",
- "service": "%(service)s"
+ "service": {
+ "host": "%(host)s",
+ "binary": "%(binary)s",
+ "status": "enabled"
+ }
}
+
diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py
index 1ca839b3f..c647e0292 100644
--- a/nova/tests/integrated/test_api_samples.py
+++ b/nova/tests/integrated/test_api_samples.py
@@ -1990,24 +1990,24 @@ class ServicesJsonTest(ApiSampleTestBase):
def test_service_enable(self):
"""Enable an existing agent build."""
subs = {"host": "host1",
- 'service': 'nova-compute'}
- response = self._do_put('/os-services/enable',
+ 'binary': 'nova-compute'}
+ response = self._do_put('os-services/enable',
'service-enable-put-req', subs)
self.assertEqual(response.status, 200)
subs = {"host": "host1",
- "service": "nova-compute"}
+ "binary": "nova-compute"}
return self._verify_response('service-enable-put-resp',
subs, response)
def test_service_disable(self):
"""Disable an existing agent build."""
subs = {"host": "host1",
- 'service': 'nova-compute'}
- response = self._do_put('/os-services/disable',
+ 'binary': 'nova-compute'}
+ response = self._do_put('os-services/disable',
'service-disable-put-req', subs)
self.assertEqual(response.status, 200)
subs = {"host": "host1",
- "service": "nova-compute"}
+ "binary": "nova-compute"}
return self._verify_response('service-disable-put-resp',
subs, response)