Fix remove_fixed_ip test with CastAsCall

If you enable CastAsCall, a bunch of issues with the remove_fixed_ip
API sample integration test crops up.

Firstly, the sample network is getting created with 'fake-mini' from
CONF.host as the network host rather than the host UUID generated for
the network service in start_service(). This results in
allocate_fixed_ip() attempting to invoke an RPC on a non-existant host.

Secondly, the test is attempting to remove a fixed IP which was never
allocated. Use the add_fixed_ip() test to allocate a fixed IP and then
remove that one, which is 10.0.0.3 rather than 10.0.0.2 which is the
IP reserved for VPN.

Lastly, disable the instance DNS manager because it seems this isn't
compatible with multinic. I was getting FloatingIpDNSExists raised.

blueprint: oslo-messaging
Related-Bug: #1213251
Change-Id: I9854863bbec8834c638c55832411f63da570f82d
This commit is contained in:
Mark McLoughlin
2013-08-16 22:28:44 +01:00
parent b2803d73db
commit 454dce8271
2 changed files with 20 additions and 4 deletions
+4 -1
View File
@@ -116,10 +116,13 @@ class SampleNetworks(fixtures.Fixture):
"""Create sample networks in the database."""
def __init__(self, host=None):
self.host = host
def setUp(self):
super(SampleNetworks, self).setUp()
ctxt = context.get_admin_context()
network = network_manager.VlanManager()
network = network_manager.VlanManager(host=self.host)
bridge_interface = CONF.flat_interface or CONF.vlan_interface
network.create_networks(ctxt,
label='test',
+16 -3
View File
@@ -387,7 +387,7 @@ class ApiSampleTestBaseV2(ApiSampleTestBase):
ext = [self.extension_name] if self.extension_name else []
self.flags(osapi_compute_extension=ext + extends)
super(ApiSampleTestBaseV2, self).setUp()
self.useFixture(test.SampleNetworks())
self.useFixture(test.SampleNetworks(host=self.network.host))
fake_network.stub_compute_with_ips(self.stubs)
fake_utils.stub_out_utils_spawn_n(self.stubs)
self.generate_samples = os.getenv('GENERATE_SAMPLES') is not None
@@ -3182,18 +3182,31 @@ class FloatingIPPoolsSampleXmlTests(FloatingIPPoolsSampleJsonTests):
class MultinicSampleJsonTest(ServersSampleBase):
extension_name = "nova.api.openstack.compute.contrib.multinic.Multinic"
def _disable_instance_dns_manager(self):
# NOTE(markmc): it looks like multinic and instance_dns_manager are
# incompatible. See:
# https://bugs.launchpad.net/nova/+bug/1213251
self.flags(
instance_dns_manager='nova.network.noop_dns_driver.NoopDNSDriver')
def setUp(self):
self._disable_instance_dns_manager()
super(MultinicSampleJsonTest, self).setUp()
self.uuid = self._post_server()
def test_add_fixed_ip(self):
def _add_fixed_ip(self):
subs = {"networkId": 1}
response = self._do_post('servers/%s/action' % (self.uuid),
'multinic-add-fixed-ip-req', subs)
self.assertEqual(response.status, 202)
def test_add_fixed_ip(self):
self._add_fixed_ip()
def test_remove_fixed_ip(self):
subs = {"ip": "10.0.0.2"}
self._add_fixed_ip()
subs = {"ip": "10.0.0.4"}
response = self._do_post('servers/%s/action' % (self.uuid),
'multinic-remove-fixed-ip-req', subs)
self.assertEqual(response.status, 202)