Beispiel #1
0
def setup():
    ''' for nova test.py create a dummy clean.sqlite '''
    cleandb = os.path.join(CONF.state_path, CONF.sqlite_clean_db)
    if os.path.exists(cleandb):
        pass
    else:
        open(cleandb, 'w').close()
    ''' for healthnmon create db '''
    healthnmon_path = os.path.abspath(
        os.path.join(healthnmon.get_healthnmon_location(), '../'))
    sql_connection_url = "sqlite:///" + str(healthnmon_path) + "/$sqlite_db"
    CONF.set_default("sql_connection", sql_connection_url)
    testdb = os.path.join(healthnmon_path, CONF.sqlite_db)
    if os.path.exists(testdb):
        return
    nova_migration.db_sync()
    healthnmon_migration.db_sync()
    cleandb = os.path.join(healthnmon_path, CONF.sqlite_clean_db)
    shutil.copyfile(testdb, cleandb)
Beispiel #2
0
def setup():
    ''' for nova test.py create a dummy clean.sqlite '''
    cleandb = os.path.join(CONF.state_path, CONF.sqlite_clean_db)
    if os.path.exists(cleandb):
        pass
    else:
        open(cleandb, 'w').close()

    ''' for healthnmon create db '''
    healthnmon_path = os.path.abspath(
        os.path.join(healthnmon.get_healthnmon_location(), '../'))
    sql_connection_url = "sqlite:///" + str(healthnmon_path) + "/$sqlite_db"
    CONF.set_default("sql_connection", sql_connection_url)
    testdb = os.path.join(healthnmon_path, CONF.sqlite_db)
    if os.path.exists(testdb):
        return
    nova_migration.db_sync()
    healthnmon_migration.db_sync()
    cleandb = os.path.join(healthnmon_path, CONF.sqlite_clean_db)
    shutil.copyfile(testdb, cleandb)
Beispiel #3
0
 def test_dbSync_versionNone(self):
     self.assertEqual(migration.db_sync(None), None)
Beispiel #4
0
 def test_dbSync_downgrade(self):
     self.assertEqual(migration.db_sync(1), None)
Beispiel #5
0
 def test_dbSync(self):
     self.assertEqual(migration.db_sync(0), None)