]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
add test for create subnet with default gateway and conflict allocation pool
authorHe Jie Xu <xuhj@linux.vnet.ibm.com>
Sat, 13 Oct 2012 10:00:20 +0000 (18:00 +0800)
committerHe Jie Xu <xuhj@linux.vnet.ibm.com>
Sat, 13 Oct 2012 23:54:06 +0000 (07:54 +0800)
Create subnet with default gateway and conflict allocation pool should return
status code 409:
$ quantum subnet-create net1 --allocation-pool start=10.0.0.1,end=10.0.0.5 \
10.0.0.0/24
Found overlapping allocation pools:{u'start': u'10.0.0.1',
u'end': u'10.0.0.5'} 10.0.0.1 for subnet 10.0.0.0/24.

Change-Id: I8608314ad7899a752eea239dbe224e25c00a375b

quantum/tests/unit/test_db_plugin.py

index 8c9377387eb3252788c7c9f8216fd81c0600887d..3d27049774f9429e6c0ca173e95cc8be2c3f35ba 100644 (file)
@@ -2037,6 +2037,16 @@ class TestSubnetsV2(QuantumDbPluginV2TestCase):
         enable_dhcp = False
         self._test_create_subnet(enable_dhcp=enable_dhcp)
 
+    def test_create_subnet_default_gw_conflict_allocation_pool_returns_409(
+        self):
+        cidr = '10.0.0.0/24'
+        allocation_pools = [{'start': '10.0.0.1',
+                             'end': '10.0.0.5'}]
+        with self.assertRaises(webob.exc.HTTPClientError) as ctx_manager:
+            self._test_create_subnet(cidr=cidr,
+                                     allocation_pools=allocation_pools)
+        self.assertEquals(ctx_manager.exception.code, 409)
+
     def test_create_subnet_gateway_in_allocation_pool_returns_409(self):
         gateway_ip = '10.0.0.50'
         cidr = '10.0.0.0/24'