コード例 #1
0
 def test_sync_and_version(self):
     migration.db_sync()
     engine = db_api.get_engine()
     v = migration.get_backend().db_version(engine,
                                            migration.MIGRATE_REPO_PATH,
                                            None)
     self.assertTrue(v > base.INIT_VERSION)
コード例 #2
0
ファイル: base.py プロジェクト: starlingx/fault
    def setUp(self):
        """Run before each test method to initialize test environment."""
        super(TestCase, self).setUp()

        test_timeout = os.environ.get('OS_TEST_TIMEOUT', 0)
        try:
            test_timeout = int(test_timeout)
        except ValueError:
            # If timeout value is invalid do not set a timeout.
            test_timeout = 0
        if test_timeout > 0:
            self.useFixture(fixtures.Timeout(test_timeout, gentle=True))
        self.useFixture(fixtures.NestedTempfile())
        self.useFixture(fixtures.TempHomeDir())

        if (os.environ.get('OS_STDOUT_CAPTURE') == 'True' or
                os.environ.get('OS_STDOUT_CAPTURE') == '1'):
            stdout = self.useFixture(fixtures.StringStream('stdout')).stream
            self.useFixture(fixtures.MonkeyPatch('sys.stdout', stdout))
        if (os.environ.get('OS_STDERR_CAPTURE') == 'True' or
                os.environ.get('OS_STDERR_CAPTURE') == '1'):
            stderr = self.useFixture(fixtures.StringStream('stderr')).stream
            self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr))

        self.log_fixture = self.useFixture(fixtures.FakeLogger())

        def fake_logging_setup(*args):
            pass

        self.useFixture(
            fixtures.MonkeyPatch('oslo_log.log.setup', fake_logging_setup))

        logging.register_options(CONF)

        self.useFixture(conf_fixture.ConfFixture(CONF))

        global _DB_CACHE
        if not _DB_CACHE:
            engine = enginefacade.get_legacy_facade().get_engine()
            engine.dispose()
            engine.connect()
            migration.db_sync(engine=engine)
コード例 #3
0
ファイル: dbsync.py プロジェクト: MarioCarrilloA/fault
def main():
    migration.db_sync()
コード例 #4
0
def main():
    cfg.CONF(sys.argv[1:], project='fm')
    migration.db_sync()