summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorBen Nemec <bnemec@us.ibm.com>2013-04-05 16:48:01 +0000
committerBen Nemec <bnemec@us.ibm.com>2013-04-08 21:48:03 +0000
commit8eadd2aee9086815f9fe600d1e2d26145d7b5c16 (patch)
tree8471ab220364c13cb4f0bae9ffe4882892cc3c48 /nova/tests
parent88cd09445ea46bba0f62ef58894fd92243021a88 (diff)
Raise correct exception for duplicate networks
When using Quantum, if duplicate network ids are passed in on a nova boot, nova-api raises a NetworkNotFound exception, which is not correct. This change causes it to raise a NetworkDuplicated exception instead. Fixes bug 1165088 Change-Id: I4f1f9aa5e1fa0e740b78e67760d924e2dd1d4d98
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/network/test_quantumv2.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/nova/tests/network/test_quantumv2.py b/nova/tests/network/test_quantumv2.py
index 6a3b31412..95352425e 100644
--- a/nova/tests/network/test_quantumv2.py
+++ b/nova/tests/network/test_quantumv2.py
@@ -825,6 +825,20 @@ class TestQuantumv2(test.TestCase):
except exception.NetworkNotFound as ex:
self.assertTrue("my_netid2, my_netid3" in str(ex))
+ def test_validate_networks_duplicate(self):
+ """Verify that the correct exception is thrown when duplicate
+ network ids are passed to validate_networks.
+ """
+ requested_networks = [('my_netid1', None, None),
+ ('my_netid1', None, None)]
+ self.mox.ReplayAll()
+ # Expected call from setUp.
+ quantumv2.get_client(None)
+ api = quantumapi.API()
+ self.assertRaises(exception.NetworkDuplicated,
+ api.validate_networks,
+ self.context, requested_networks)
+
def _mock_list_ports(self, port_data=None):
if port_data is None:
port_data = self.port_data2