cleanup leftover addresses

This commit is contained in:
Vishvananda Ishaya
2010-10-12 20:13:06 -07:00
parent 7ffd4110a6
commit 4273f3edb8
2 changed files with 6 additions and 2 deletions

View File

@@ -24,6 +24,7 @@ and some black magic for inline callbacks.
import sys import sys
import time import time
import datetime
import mox import mox
import stubout import stubout
@@ -62,6 +63,7 @@ class TrialTestCase(unittest.TestCase):
# NOTE(vish): We need a better method for creating fixtures for tests # NOTE(vish): We need a better method for creating fixtures for tests
# now that we have some required db setup for the system # now that we have some required db setup for the system
# to work properly. # to work properly.
self.start = datetime.datetime.utcnow()
if db.network_count(None) != 5: if db.network_count(None) != 5:
network_manager.VlanManager().create_networks(None, network_manager.VlanManager().create_networks(None,
FLAGS.fixed_range, FLAGS.fixed_range,
@@ -84,6 +86,8 @@ class TrialTestCase(unittest.TestCase):
self.stubs.UnsetAll() self.stubs.UnsetAll()
self.stubs.SmartUnsetAll() self.stubs.SmartUnsetAll()
self.mox.VerifyAll() self.mox.VerifyAll()
# NOTE(vish): Clean up any ips associated during the test.
db.fixed_ip_disassociate_all_by_timeout(None, FLAGS.host, self.start)
db.network_disassociate_all(None) db.network_disassociate_all(None)
rpc.Consumer.attach_to_twisted = self.originalAttach rpc.Consumer.attach_to_twisted = self.originalAttach
for x in self.injected: for x in self.injected:

View File

@@ -64,12 +64,12 @@ class CloudTestCase(test.TrialTestCase):
self.cloud = cloud.CloudController() self.cloud = cloud.CloudController()
# set up a service # set up a service
self.compute = utils.import_class(FLAGS.compute_manager)() self.compute = utils.import_object(FLAGS.compute_manager)
self.compute_consumer = rpc.AdapterConsumer(connection=self.conn, self.compute_consumer = rpc.AdapterConsumer(connection=self.conn,
topic=FLAGS.compute_topic, topic=FLAGS.compute_topic,
proxy=self.compute) proxy=self.compute)
self.compute_consumer.attach_to_eventlet() self.compute_consumer.attach_to_eventlet()
self.network = utils.import_class(FLAGS.network_manager)() self.network = utils.import_object(FLAGS.network_manager)
self.network_consumer = rpc.AdapterConsumer(connection=self.conn, self.network_consumer = rpc.AdapterConsumer(connection=self.conn,
topic=FLAGS.network_topic, topic=FLAGS.network_topic,
proxy=self.network) proxy=self.network)