summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJohn Garbutt <john.garbutt@citrix.com>2012-02-28 18:14:25 +0000
committerJohn Garbutt <john.garbutt@citrix.com>2012-02-28 18:14:25 +0000
commit9f7595aa0f464dc7344e0639951ea731dcfbeca5 (patch)
treed811a7117d64fcdf77545a07a430fd9978c6e472 /nova/tests
parent85f844c26e1a51665891ede3e5696d13433a7c59 (diff)
Fixes bug 942549
Ensure a more meaninful error is reported when an aggregate is created in a non-exsistent availability zone. Change-Id: I15ea6c884bb6f326df1d88019ee0ecf070196d1e
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/api/openstack/compute/contrib/test_aggregates.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/nova/tests/api/openstack/compute/contrib/test_aggregates.py b/nova/tests/api/openstack/compute/contrib/test_aggregates.py
index 6c8bc5a2f..080cf8428 100644
--- a/nova/tests/api/openstack/compute/contrib/test_aggregates.py
+++ b/nova/tests/api/openstack/compute/contrib/test_aggregates.py
@@ -87,6 +87,17 @@ class AggregateTestCase(test.TestCase):
{"name": "test",
"availability_zone": "nova1"}})
+ def test_create_with_incorrect_availability_zone(self):
+ def stub_create_aggregate(context, name, availability_zone):
+ raise exception.InvalidAggregateAction
+ self.stubs.Set(self.controller.api, "create_aggregate",
+ stub_create_aggregate)
+
+ self.assertRaises(exc.HTTPConflict, self.controller.create,
+ self.req, {"aggregate":
+ {"name": "test",
+ "availability_zone": "nova_bad"}})
+
def test_create_with_no_aggregate(self):
self.assertRaises(exc.HTTPBadRequest, self.controller.create,
self.req, {"foo":