diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-05-01 14:20:36 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-05-01 14:20:36 +0000 |
| commit | 69991d60cffbdc715faff2d55727a161f8e57051 (patch) | |
| tree | f52210b9ec18b4eb97fec92dec1ff126baef2d85 /nova/tests | |
| parent | 7cd8f22354b4ba5768cda410267c225449f78b8d (diff) | |
| parent | 09c7fc3b694ab401d42c9e59b17e24bbe4383588 (diff) | |
Merge "Catch glance image create exceptions"
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/api/openstack/compute/test_server_actions.py | 13 | ||||
| -rw-r--r-- | nova/tests/api/openstack/fakes.py | 3 |
2 files changed, 16 insertions, 0 deletions
diff --git a/nova/tests/api/openstack/compute/test_server_actions.py b/nova/tests/api/openstack/compute/test_server_actions.py index c5d57ecbb..fe65fe0d9 100644 --- a/nova/tests/api/openstack/compute/test_server_actions.py +++ b/nova/tests/api/openstack/compute/test_server_actions.py @@ -745,6 +745,19 @@ class ServerActionsControllerTest(test.TestCase): location = response.headers['Location'] self.assertEqual('http://localhost/v2/fake/images/123', location) + def test_create_image_name_too_long(self): + long_name = 'a' * 260 + body = { + 'createImage': { + 'name': long_name, + }, + } + + req = fakes.HTTPRequest.blank(self.url) + self.assertRaises(webob.exc.HTTPBadRequest, + self.controller._action_create_image, req, + FAKE_UUID, body) + def _do_test_create_volume_backed_image(self, extra_properties): def _fake_id(x): diff --git a/nova/tests/api/openstack/fakes.py b/nova/tests/api/openstack/fakes.py index bf7c4d0d4..9e7b99bea 100644 --- a/nova/tests/api/openstack/fakes.py +++ b/nova/tests/api/openstack/fakes.py @@ -158,6 +158,9 @@ def stub_out_networking(stubs): def stub_out_compute_api_snapshot(stubs): def snapshot(self, context, instance, name, extra_properties=None): + # emulate glance rejecting image names which are too long + if len(name) > 256: + raise exc.Invalid return dict(id='123', status='ACTIVE', name=name, properties=extra_properties) |
