summaryrefslogtreecommitdiffstats
path: root/nova/test.py
diff options
context:
space:
mode:
Diffstat (limited to 'nova/test.py')
-rw-r--r--nova/test.py32
1 files changed, 8 insertions, 24 deletions
diff --git a/nova/test.py b/nova/test.py
index e0e203647..d8a47464f 100644
--- a/nova/test.py
+++ b/nova/test.py
@@ -22,26 +22,28 @@ Allows overriding of flags for use of fakes,
and some black magic for inline callbacks.
"""
+
import datetime
+import os
+import shutil
import uuid
import unittest
import mox
+import shutil
import stubout
from nova import context
from nova import db
from nova import fakerabbit
from nova import flags
-from nova import log as logging
from nova import rpc
from nova import service
-from nova.network import manager as network_manager
FLAGS = flags.FLAGS
-flags.DEFINE_bool('flush_db', True,
- 'Flush the database before running fake tests')
+flags.DEFINE_string('sqlite_clean_db', 'clean.sqlite',
+ 'File name of clean sqlite db')
flags.DEFINE_bool('fake_tests', True,
'should we use everything for testing')
@@ -66,15 +68,8 @@ class TestCase(unittest.TestCase):
# now that we have some required db setup for the system
# to work properly.
self.start = datetime.datetime.utcnow()
- ctxt = context.get_admin_context()
- if db.network_count(ctxt) != 5:
- network_manager.VlanManager().create_networks(ctxt,
- FLAGS.fixed_range,
- 5, 16,
- FLAGS.fixed_range_v6,
- FLAGS.vlan_start,
- FLAGS.vpn_start,
- )
+ shutil.copyfile(os.path.join(FLAGS.state_path, FLAGS.sqlite_clean_db),
+ os.path.join(FLAGS.state_path, FLAGS.sqlite_db))
# emulate some of the mox stuff, we can't use the metaclass
# because it screws with our generators
@@ -96,17 +91,6 @@ class TestCase(unittest.TestCase):
self.mox.VerifyAll()
super(TestCase, self).tearDown()
finally:
- try:
- # Clean up any ips associated during the test.
- ctxt = context.get_admin_context()
- db.fixed_ip_disassociate_all_by_timeout(ctxt, FLAGS.host,
- self.start)
- db.network_disassociate_all(ctxt)
-
- db.security_group_destroy_all(ctxt)
- except Exception:
- pass
-
# Clean out fake_rabbit's queue if we used it
if FLAGS.fake_rabbit:
fakerabbit.reset_all()