ec2_api commands for describe_addresses and associate_address are broken in trunk. This happened during the switch to ec2_id and internal_id. We clearly didn't have any unit tests for this, so I've added a couple in addition to the three line change to actually fix the bugs.
This commit is contained in:
@@ -91,6 +91,37 @@ class CloudTestCase(test.TrialTestCase):
|
|||||||
# NOTE(vish): create depends on pool, so just call helper directly
|
# NOTE(vish): create depends on pool, so just call helper directly
|
||||||
return cloud._gen_key(self.context, self.context.user.id, name)
|
return cloud._gen_key(self.context, self.context.user.id, name)
|
||||||
|
|
||||||
|
def test_describe_addresses(self):
|
||||||
|
"""Makes sure describe addresses runs without raising an exception"""
|
||||||
|
address = "10.10.10.10"
|
||||||
|
db.floating_ip_create(self.context,
|
||||||
|
{'address': address,
|
||||||
|
'host': FLAGS.host})
|
||||||
|
self.cloud.allocate_address(self.context)
|
||||||
|
self.cloud.describe_addresses(self.context)
|
||||||
|
self.cloud.release_address(self.context,
|
||||||
|
public_ip=address)
|
||||||
|
db.floating_ip_destroy(self.context, address)
|
||||||
|
|
||||||
|
def test_associate_disassociate_address(self):
|
||||||
|
"""Verifies associate runs cleanly without raising an exception"""
|
||||||
|
address = "10.10.10.10"
|
||||||
|
db.floating_ip_create(self.context,
|
||||||
|
{'address': address,
|
||||||
|
'host': FLAGS.host})
|
||||||
|
self.cloud.allocate_address(self.context)
|
||||||
|
inst = db.instance_create(self.context, {})
|
||||||
|
ec2_id = cloud.internal_id_to_ec2_id(inst['internal_id'])
|
||||||
|
self.cloud.associate_address(self.context,
|
||||||
|
instance_id=ec2_id,
|
||||||
|
public_ip=address)
|
||||||
|
self.cloud.disassociate_address(self.context,
|
||||||
|
public_ip=address)
|
||||||
|
self.cloud.release_address(self.context,
|
||||||
|
public_ip=address)
|
||||||
|
db.instance_destroy(self.context, inst['id'])
|
||||||
|
db.floating_ip_destroy(self.context, address)
|
||||||
|
|
||||||
def test_console_output(self):
|
def test_console_output(self):
|
||||||
image_id = FLAGS.default_image
|
image_id = FLAGS.default_image
|
||||||
instance_type = FLAGS.default_instance_type
|
instance_type = FLAGS.default_instance_type
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ class NetworkTestCase(test.TrialTestCase):
|
|||||||
# flags in the corresponding section in nova-dhcpbridge
|
# flags in the corresponding section in nova-dhcpbridge
|
||||||
self.flags(connection_type='fake',
|
self.flags(connection_type='fake',
|
||||||
fake_network=True,
|
fake_network=True,
|
||||||
auth_driver='nova.auth.ldapdriver.FakeLdapDriver',
|
|
||||||
network_size=16,
|
network_size=16,
|
||||||
num_networks=5)
|
num_networks=5)
|
||||||
logging.getLogger().setLevel(logging.DEBUG)
|
logging.getLogger().setLevel(logging.DEBUG)
|
||||||
@@ -127,6 +126,7 @@ class NetworkTestCase(test.TrialTestCase):
|
|||||||
self.network.deallocate_floating_ip(self.context, float_addr)
|
self.network.deallocate_floating_ip(self.context, float_addr)
|
||||||
self.network.deallocate_fixed_ip(self.context, fix_addr)
|
self.network.deallocate_fixed_ip(self.context, fix_addr)
|
||||||
release_ip(fix_addr)
|
release_ip(fix_addr)
|
||||||
|
db.floating_ip_destroy(context.get_admin_context(), float_addr)
|
||||||
|
|
||||||
def test_allocate_deallocate_fixed_ip(self):
|
def test_allocate_deallocate_fixed_ip(self):
|
||||||
"""Makes sure that we can allocate and deallocate a fixed ip"""
|
"""Makes sure that we can allocate and deallocate a fixed ip"""
|
||||||
|
|||||||
Reference in New Issue
Block a user