def test_mysql_opportunistically(self): if not db_test_utils.is_backend_avail('mysql'): raise self.skipTest('mysql is not available') self.useFixture(fixtures.LockFixture('mysql')) self.useFixture(fixtures.MySQLConfFixture()) # Test that table creation on mysql only builds InnoDB tables # add this to the global lists to make reset work with it, it's removed # automatically in tearDown so no need to clean it up here. connect_string = db_test_utils.get_connect_string("mysql") engine = sqlalchemy.create_engine(connect_string) self.engines["mysqlcitest"] = engine self.test_databases["mysqlcitest"] = connect_string # build a fully populated mysql database with all the tables self._walk_versions(engine) connection = engine.connect() # sanity check total = connection.execute("SELECT count(*) " "from information_schema.TABLES " "where TABLE_SCHEMA='openstack_citest'") self.assertTrue(total.scalar() > 0, "No tables found. Wrong schema?") noninnodb = connection.execute("SELECT count(*) " "from information_schema.TABLES " "where TABLE_SCHEMA='openstack_citest' " "and ENGINE!='InnoDB' " "and TABLE_NAME!='alembic_version'") count = noninnodb.scalar() self.assertEqual(count, 0, "%d non InnoDB tables created" % count) connection.close()
def test_mysql_opportunistically(self): self.useFixture(fixtures.LockFixture('mysql')) if not db_test_utils.is_backend_avail('mysql'): raise self.skipTest('mysql is not available') self.useFixture(fixtures.MySQLConfFixture()) # Test that table creation on mysql only builds InnoDB tables # add this to the global lists to make reset work with it, it's removed # automatically in tearDown so no need to clean it up here. connect_string = db_test_utils.get_connect_string("mysql") engine = sqlalchemy.create_engine(connect_string) self.engines["mysqlcitest"] = engine self.test_databases["mysqlcitest"] = connect_string # build a fully populated mysql database with all the tables self._walk_versions(engine) connection = engine.connect() # sanity check total = connection.execute("SELECT count(*) " "from information_schema.TABLES " "where TABLE_SCHEMA='openstack_citest'") self.assertTrue(total.scalar() > 0, "No tables found. Wrong schema?") noninnodb = connection.execute("SELECT count(*) " "from information_schema.TABLES " "where TABLE_SCHEMA='openstack_citest' " "and ENGINE!='InnoDB' " "and TABLE_NAME!='alembic_version'") count = noninnodb.scalar() self.assertEqual(count, 0, "%d non InnoDB tables created" % count) connection.close()
def setUp(self): super(MySQLConfFixture, self).setUp() self.register_opts(options.database_opts, group='database') self.url = db_test_utils.get_connect_string("mysql") self.set_default('connection', self.url, group='database') lockutils.set_defaults(lock_path='/tmp') self._drop_db()
def setUp(self): super(MySQLConfFixture, self).setUp() self.register_opts(options.database_opts, group='database') self.url = db_test_utils.get_connect_string("mysql") self.set_default('connection', self.url, group='database') lockutils.set_defaults(lock_path='/tmp') self._drop_db()
def setUp(self): super(PostgresConfFixture, self).setUp() self.register_opts(options.database_opts, group='database') self.register_opts(cli.MIGRATION_OPTS) self.url = db_test_utils.get_connect_string("postgres") self.set_default('connection', self.url, group='database') self.set_default('disable_microsecond_data_migration', False) lockutils.set_defaults(lock_path='/tmp') self._drop_db()
def setUp(self): super(PostgresConfFixture, self).setUp() self.register_opts(options.database_opts, group='database') self.register_opts(cli.MIGRATION_OPTS) self.url = db_test_utils.get_connect_string("postgres") self.set_default('connection', self.url, group='database') self.set_default('disable_microsecond_data_migration', False) lockutils.set_defaults(lock_path='/tmp') self._drop_db()
def test_sqlite_opportunistically(self): self.useFixture(fixtures.LockFixture('sqlite')) self.useFixture(fixtures.SqliteConfFixture()) connect_string = db_test_utils.get_connect_string("sqlite") engine = sqlalchemy.create_engine(connect_string) self.engines["sqlitecitest"] = engine self.test_databases["sqlitecitest"] = connect_string self._walk_versions(engine)
def test_sqlite_opportunistically(self): self.useFixture(fixtures.LockFixture('sqlite')) self.useFixture(fixtures.SqliteConfFixture()) connect_string = db_test_utils.get_connect_string("sqlite") engine = sqlalchemy.create_engine(connect_string) self.engines["sqlitecitest"] = engine self.test_databases["sqlitecitest"] = connect_string self._walk_versions(engine)
def setUp(self): super(TestModelsMigrations, self).setUp() self.useFixture(fixtures.LockFixture(self.dialect)) if not db_test_utils.is_backend_avail(self.dialect): raise self.skipTest('%s is not available' % self.dialect) if self.dialect == 'sqlite': raise self.skipException('sqlite skipped because of model sync ' 'issue with BigInteger vs Integer') if self.dialect == 'mysql': self.useFixture(fixtures.MySQLConfFixture()) elif self.dialect == 'postgres': self.useFixture(fixtures.PostgresConfFixture()) connect_string = db_test_utils.get_connect_string(self.dialect) self.engine = sqlalchemy.create_engine(connect_string)
def setUp(self): super(TestModelsMigrations, self).setUp() self.useFixture(fixtures.LockFixture(self.dialect)) if not db_test_utils.is_backend_avail(self.dialect): raise self.skipTest('%s is not available' % self.dialect) if self.dialect == 'sqlite': raise self.skipException('sqlite skipped because of model sync ' 'issue with BigInteger vs Integer') if self.dialect == 'mysql': self.useFixture(fixtures.MySQLConfFixture()) elif self.dialect == 'postgres': self.useFixture(fixtures.PostgresConfFixture()) connect_string = db_test_utils.get_connect_string(self.dialect) self.engine = sqlalchemy.create_engine(connect_string)
def test_postgresql_opportunistically(self): # Test postgresql database migration walk self.useFixture(fixtures.LockFixture('postgres')) if not db_test_utils.is_backend_avail('postgres'): raise self.skipTest('postgres is not available') self.useFixture(fixtures.PostgresConfFixture()) # add this to the global lists to make reset work with it, it's removed # automatically in tearDown so no need to clean it up here. connect_string = db_test_utils.get_connect_string("postgres") engine = sqlalchemy.create_engine(connect_string) self.engines["postgresqlcitest"] = engine self.test_databases["postgresqlcitest"] = connect_string # build a fully populated postgresql database with all the tables self._walk_versions(engine)
def test_postgresql_opportunistically(self): # Test postgresql database migration walk if not db_test_utils.is_backend_avail('postgres'): raise self.skipTest('postgres is not available') self.useFixture(fixtures.LockFixture('postgres')) self.useFixture(fixtures.PostgresConfFixture()) # add this to the global lists to make reset work with it, it's removed # automatically in tearDown so no need to clean it up here. connect_string = db_test_utils.get_connect_string("postgres") engine = sqlalchemy.create_engine(connect_string) self.engines["postgresqlcitest"] = engine self.test_databases["postgresqlcitest"] = connect_string # build a fully populated postgresql database with all the tables self._walk_versions(engine)