fix fakeldap so it can use redis keeper

This commit is contained in:
Vishvananda Ishaya
2010-06-24 04:11:59 +01:00
committed by andy
parent 9d9bdede4a
commit 36e2a747de
2 changed files with 9 additions and 1 deletions

View File

@@ -40,7 +40,7 @@ def initialize(uri):
class FakeLDAP(object):
def __init__(self, _uri):
self.keeper = datastore.SqliteKeeper('fakeldap') #Redis keeper never works here...
self.keeper = datastore.Keeper('fakeldap')
if self.keeper['objects'] is None:
self.keeper['objects'] = {}

View File

@@ -60,6 +60,8 @@ from nova.tests.validator_unittest import *
FLAGS = flags.FLAGS
flags.DEFINE_bool('flush_db', True,
'Flush the database before running fake tests')
if __name__ == '__main__':
OptionsClass = twistd.WrapTwistedOptions(trial_script.Options)
@@ -71,6 +73,12 @@ if __name__ == '__main__':
# TODO(termie): these should make a call instead of doing work on import
if FLAGS.fake_tests:
from nova.tests.fake_flags import *
# use db 8 for fake tests
FLAGS.redis_db = 8
if FLAGS.flush_db:
logging.info("Flushing redis datastore")
r = datastore.Redis.instance()
r.flushdb()
else:
from nova.tests.real_flags import *