コード例 #1
0
    def _check_231(self, engine, data):
        self.assertColumnExists(engine, 'instances', 'ephemeral_key_uuid')

        instances = oslodbutils.get_table(engine, 'instances')
        self.assertIsInstance(instances.c.ephemeral_key_uuid.type,
                              sqlalchemy.types.String)
        self.assertTrue(db_utils.check_shadow_table(engine, 'instances'))
コード例 #2
0
    def test_create_shadow_table_not_supported_type(self):
        if 'sqlite' in self.engines:
            table_name = 'test_create_shadow_table_not_supported_type'
            engine = self.engines['sqlite']
            meta = MetaData()
            meta.bind = engine
            table = Table(table_name, meta,
                          Column('id', Integer, primary_key=True),
                          Column('a', CustomType))
            table.create()

            # reflection of custom types has been fixed upstream
            if SA_VERSION < (0, 9, 0):
                self.assertRaises(exception.NovaException,
                                  utils.create_shadow_table,
                                  engine,
                                  table_name=table_name)

            shadow_table = utils.create_shadow_table(engine,
                                                     table_name=table_name,
                                                     a=Column(
                                                         'a', CustomType()))
            self.assertTrue(utils.check_shadow_table(engine, table_name))
            table.drop()
            shadow_table.drop()
コード例 #3
0
ファイル: test_migrations.py プロジェクト: RibeiroAna/nova
    def _check_231(self, engine, data):
        self.assertColumnExists(engine, 'instances', 'ephemeral_key_uuid')

        instances = oslodbutils.get_table(engine, 'instances')
        self.assertIsInstance(instances.c.ephemeral_key_uuid.type,
                              sqlalchemy.types.String)
        self.assertTrue(db_utils.check_shadow_table(engine, 'instances'))
コード例 #4
0
ファイル: test_migration_utils.py プロジェクト: yuans/nova
    def test_check_shadow_table(self):
        table_name = 'abc'
        for key, engine in self.engines.items():
            meta = MetaData()
            meta.bind = engine

            table = Table(table_name, meta,
                          Column('id', Integer, primary_key=True),
                          Column('a', Integer), Column('c', String(256)))
            table.create()

            #check missing shadow table
            self.assertRaises(NoSuchTableError, utils.check_shadow_table,
                              engine, table_name)

            shadow_table = Table(db._SHADOW_TABLE_PREFIX + table_name, meta,
                                 Column('id', Integer), Column('a', Integer))
            shadow_table.create()

            # check missing column
            self.assertRaises(exception.NovaException,
                              utils.check_shadow_table, engine, table_name)

            # check when all is ok
            c = Column('c', String(256))
            shadow_table.create_column(c)
            self.assertTrue(utils.check_shadow_table(engine, table_name))

            # check extra column
            d = Column('d', Integer)
            shadow_table.create_column(d)
            self.assertRaises(exception.NovaException,
                              utils.check_shadow_table, engine, table_name)
コード例 #5
0
ファイル: test_migration_utils.py プロジェクト: JohnLih/nova
    def test_check_shadow_table(self):
        table_name = 'test_check_shadow_table'

        table = Table(table_name, self.meta,
                      Column('id', Integer, primary_key=True),
                      Column('a', Integer),
                      Column('c', String(256)))
        table.create()

        # check missing shadow table
        self.assertRaises(NoSuchTableError,
                          utils.check_shadow_table, self.engine, table_name)

        shadow_table = Table(db._SHADOW_TABLE_PREFIX + table_name, self.meta,
                             Column('id', Integer),
                             Column('a', Integer))
        shadow_table.create()

        # check missing column
        self.assertRaises(exception.NovaException,
                          utils.check_shadow_table, self.engine, table_name)

        # check when all is ok
        c = Column('c', String(256))
        shadow_table.create_column(c)
        self.assertTrue(utils.check_shadow_table(self.engine, table_name))

        # check extra column
        d = Column('d', Integer)
        shadow_table.create_column(d)
        self.assertRaises(exception.NovaException,
                          utils.check_shadow_table, self.engine, table_name)
コード例 #6
0
 def test_create_shadow_table_by_table_instance(self):
     table_name = 'test_create_shadow_table_by_table_instance'
     table = Table(table_name, self.meta,
                   Column('id', Integer, primary_key=True),
                   Column('a', Integer), Column('b', String(256)))
     table.create()
     utils.create_shadow_table(self.engine, table=table)
     self.assertTrue(utils.check_shadow_table(self.engine, table_name))
コード例 #7
0
ファイル: test_migration_utils.py プロジェクト: JohnLih/nova
 def test_create_shadow_table_by_table_instance(self):
     table_name = 'test_create_shadow_table_by_table_instance'
     table = Table(table_name, self.meta,
                   Column('id', Integer, primary_key=True),
                   Column('a', Integer),
                   Column('b', String(256)))
     table.create()
     utils.create_shadow_table(self.engine, table=table)
     self.assertTrue(utils.check_shadow_table(self.engine, table_name))
コード例 #8
0
ファイル: test_migration_utils.py プロジェクト: yuans/nova
 def test_create_shadow_table_by_table_instance(self):
     table_name = 'abc'
     for key, engine in self.engines.items():
         meta = MetaData()
         meta.bind = engine
         table = Table(table_name, meta,
                       Column('id', Integer, primary_key=True),
                       Column('a', Integer), Column('b', String(256)))
         table.create()
         utils.create_shadow_table(engine, table=table)
         self.assertTrue(utils.check_shadow_table(engine, table_name))
コード例 #9
0
    def test_create_shadow_table_not_supported_type(self):
        table_name = 'test_create_shadow_table_not_supported_type'
        table = Table(table_name, self.meta,
                      Column('id', Integer, primary_key=True),
                      Column('a', CustomType))
        table.create()

        utils.create_shadow_table(self.engine,
                                  table_name=table_name,
                                  a=Column('a', CustomType()))
        self.assertTrue(utils.check_shadow_table(self.engine, table_name))
コード例 #10
0
 def test_create_shadow_table_by_table_instance(self):
     table_name = 'abc'
     for key, engine in self.engines.items():
         meta = MetaData()
         meta.bind = engine
         table = Table(table_name, meta,
                       Column('id', Integer, primary_key=True),
                       Column('a', Integer),
                       Column('b', String(256)))
         table.create()
         utils.create_shadow_table(engine, table=table)
         self.assertTrue(utils.check_shadow_table(engine, table_name))
コード例 #11
0
    def test_check_shadow_table_with_unsupported_sqlite_type(self):
        table_name = 'test_check_shadow_table_with_unsupported_sqlite_type'

        table = Table(table_name, self.meta,
                      Column('id', Integer, primary_key=True),
                      Column('a', Integer), Column('c', CustomType))
        table.create()

        shadow_table = Table(db._SHADOW_TABLE_PREFIX + table_name, self.meta,
                             Column('id', Integer, primary_key=True),
                             Column('a', Integer), Column('c', CustomType))
        shadow_table.create()
        self.assertTrue(utils.check_shadow_table(self.engine, table_name))
コード例 #12
0
ファイル: test_migration_utils.py プロジェクト: ugvddm/nova
    def test_create_shadow_table_not_supported_type(self):
        if "sqlite" in self.engines:
            table_name = "test_create_shadow_table_not_supported_type"
            engine = self.engines["sqlite"]
            meta = MetaData()
            meta.bind = engine
            table = Table(table_name, meta, Column("id", Integer, primary_key=True), Column("a", CustomType))
            table.create()
            self.assertRaises(exception.NovaException, utils.create_shadow_table, engine, table_name=table_name)

            shadow_table = utils.create_shadow_table(engine, table_name=table_name, a=Column("a", CustomType()))
            self.assertTrue(utils.check_shadow_table(engine, table_name))
            table.drop()
            shadow_table.drop()
コード例 #13
0
ファイル: test_migration_utils.py プロジェクト: JohnLih/nova
    def test_check_shadow_table_with_unsupported_sqlite_type(self):
        table_name = 'test_check_shadow_table_with_unsupported_sqlite_type'

        table = Table(table_name, self.meta,
                      Column('id', Integer, primary_key=True),
                      Column('a', Integer),
                      Column('c', CustomType))
        table.create()

        shadow_table = Table(db._SHADOW_TABLE_PREFIX + table_name, self.meta,
                             Column('id', Integer, primary_key=True),
                             Column('a', Integer),
                             Column('c', CustomType))
        shadow_table.create()
        self.assertTrue(utils.check_shadow_table(self.engine, table_name))
コード例 #14
0
ファイル: test_migration_utils.py プロジェクト: yuans/nova
    def test_check_shadow_table_with_unsupported_type(self):
        table_name = 'abc'
        engine = self.engines['sqlite']
        meta = MetaData(bind=engine)

        table = Table(table_name, meta, Column('id', Integer,
                                               primary_key=True),
                      Column('a', Integer), Column('c', CustomType))
        table.create()

        shadow_table = Table(db._SHADOW_TABLE_PREFIX + table_name, meta,
                             Column('id', Integer, primary_key=True),
                             Column('a', Integer), Column('c', CustomType))
        shadow_table.create()
        self.assertTrue(utils.check_shadow_table(engine, table_name))
コード例 #15
0
    def test_create_shadow_table_not_supported_type(self):
        table_name = 'abc'
        engine = self.engines['sqlite']
        meta = MetaData()
        meta.bind = engine
        table = Table(table_name, meta,
                      Column('id', Integer, primary_key=True),
                      Column('a', CustomType))
        table.create()
        self.assertRaises(exception.NovaException,
                          utils.create_shadow_table,
                          engine, table_name=table_name)

        utils.create_shadow_table(engine, table_name=table_name,
                                  a=Column('a', CustomType()))
        self.assertTrue(utils.check_shadow_table(engine, table_name))
コード例 #16
0
    def test_create_shadow_table_not_supported_type(self):
        table_name = 'abc'
        engine = self.engines['sqlite']
        meta = MetaData()
        meta.bind = engine
        table = Table(table_name, meta,
                      Column('id', Integer, primary_key=True),
                      Column('a', CustomType))
        table.create()
        self.assertRaises(exception.NovaException,
                          utils.create_shadow_table,
                          engine, table_name=table_name)

        utils.create_shadow_table(engine, table_name=table_name,
                                  a=Column('a', CustomType()))
        self.assertTrue(utils.check_shadow_table(engine, table_name))
コード例 #17
0
    def test_create_shadow_table_not_supported_type(self):
        table_name = 'test_create_shadow_table_not_supported_type'
        table = Table(table_name, self.meta,
                      Column('id', Integer, primary_key=True),
                      Column('a', CustomType))
        table.create()

        # reflection of custom types has been fixed upstream
        if SA_VERSION < (0, 9, 0):
            self.assertRaises(oslodbutils.ColumnError,
                              utils.create_shadow_table,
                              self.engine, table_name=table_name)

        utils.create_shadow_table(self.engine,
                                  table_name=table_name,
                                  a=Column('a', CustomType()))
        self.assertTrue(utils.check_shadow_table(self.engine, table_name))
コード例 #18
0
ファイル: test_migration_utils.py プロジェクト: JohnLih/nova
    def test_create_shadow_table_not_supported_type(self):
        table_name = 'test_create_shadow_table_not_supported_type'
        table = Table(table_name, self.meta,
                      Column('id', Integer, primary_key=True),
                      Column('a', CustomType))
        table.create()

        # reflection of custom types has been fixed upstream
        if SA_VERSION < (0, 9, 0):
            self.assertRaises(oslodbutils.ColumnError,
                              utils.create_shadow_table,
                              self.engine, table_name=table_name)

        utils.create_shadow_table(self.engine,
                                  table_name=table_name,
                                  a=Column('a', CustomType()))
        self.assertTrue(utils.check_shadow_table(self.engine, table_name))
コード例 #19
0
ファイル: test_migration_utils.py プロジェクト: gilmeir/nova
    def test_create_shadow_table_not_supported_type(self):
        if "sqlite" in self.engines:
            table_name = "test_create_shadow_table_not_supported_type"
            engine = self.engines["sqlite"]
            meta = MetaData()
            meta.bind = engine
            table = Table(table_name, meta, Column("id", Integer, primary_key=True), Column("a", CustomType))
            table.create()

            # reflection of custom types has been fixed upstream
            if SA_VERSION < (0, 9, 0):
                self.assertRaises(oslodbutils.ColumnError, utils.create_shadow_table, engine, table_name=table_name)

            shadow_table = utils.create_shadow_table(engine, table_name=table_name, a=Column("a", CustomType()))
            self.assertTrue(utils.check_shadow_table(engine, table_name))
            table.drop()
            shadow_table.drop()
コード例 #20
0
ファイル: test_migration_utils.py プロジェクト: ugvddm/nova
 def test_create_shadow_table_by_table_instance(self):
     table_name = "test_create_shadow_table_by_table_instance"
     for key, engine in self.engines.items():
         meta = MetaData()
         meta.bind = engine
         table = Table(
             table_name,
             meta,
             Column("id", Integer, primary_key=True),
             Column("a", Integer),
             Column("b", String(256)),
         )
         table.create()
         shadow_table = utils.create_shadow_table(engine, table=table)
         self.assertTrue(utils.check_shadow_table(engine, table_name))
         table.drop()
         shadow_table.drop()
コード例 #21
0
    def test_check_shadow_table_with_unsupported_type(self):
        table_name = 'abc'
        engine = self.engines['sqlite']
        meta = MetaData(bind=engine)

        table = Table(table_name, meta,
                      Column('id', Integer, primary_key=True),
                      Column('a', Integer),
                      Column('c', CustomType))
        table.create()

        shadow_table = Table(db._SHADOW_TABLE_PREFIX + table_name, meta,
                             Column('id', Integer, primary_key=True),
                             Column('a', Integer),
                             Column('c', CustomType))
        shadow_table.create()
        self.assertTrue(utils.check_shadow_table(engine, table_name))
コード例 #22
0
    def test_check_shadow_table_with_unsupported_sqlite_type(self):
        if 'sqlite' not in self.engines:
            self.skipTest('sqlite is not configured')
        table_name = 'test_check_shadow_table_with_unsupported_sqlite_type'
        engine = self.engines['sqlite']
        meta = MetaData(bind=engine)

        table = Table(table_name, meta, Column('id', Integer,
                                               primary_key=True),
                      Column('a', Integer), Column('c', CustomType))
        table.create()

        shadow_table = Table(db._SHADOW_TABLE_PREFIX + table_name, meta,
                             Column('id', Integer, primary_key=True),
                             Column('a', Integer), Column('c', CustomType))
        shadow_table.create()
        self.assertTrue(utils.check_shadow_table(engine, table_name))
        shadow_table.drop()
コード例 #23
0
ファイル: test_migration_utils.py プロジェクト: FengYang/nova
    def test_check_shadow_table_with_unsupported_sqlite_type(self):
        if 'sqlite' not in self.engines:
            self.skipTest('sqlite is not configured')
        table_name = 'test_check_shadow_table_with_unsupported_sqlite_type'
        engine = self.engines['sqlite']
        meta = MetaData(bind=engine)

        table = Table(table_name, meta,
                      Column('id', Integer, primary_key=True),
                      Column('a', Integer),
                      Column('c', CustomType))
        table.create()

        shadow_table = Table(db._SHADOW_TABLE_PREFIX + table_name, meta,
                             Column('id', Integer, primary_key=True),
                             Column('a', Integer),
                             Column('c', CustomType))
        shadow_table.create()
        self.assertTrue(utils.check_shadow_table(engine, table_name))
        shadow_table.drop()
コード例 #24
0
ファイル: test_migration_utils.py プロジェクト: ugvddm/nova
    def test_check_shadow_table_with_unsupported_sqlite_type(self):
        if "sqlite" not in self.engines:
            self.skipTest("sqlite is not configured")
        table_name = "test_check_shadow_table_with_unsupported_sqlite_type"
        engine = self.engines["sqlite"]
        meta = MetaData(bind=engine)

        table = Table(
            table_name, meta, Column("id", Integer, primary_key=True), Column("a", Integer), Column("c", CustomType)
        )
        table.create()

        shadow_table = Table(
            db._SHADOW_TABLE_PREFIX + table_name,
            meta,
            Column("id", Integer, primary_key=True),
            Column("a", Integer),
            Column("c", CustomType),
        )
        shadow_table.create()
        self.assertTrue(utils.check_shadow_table(engine, table_name))
        shadow_table.drop()
コード例 #25
0
ファイル: test_migration_utils.py プロジェクト: ugvddm/nova
    def test_check_shadow_table(self):
        table_name = "test_check_shadow_table"
        for key, engine in self.engines.items():
            meta = MetaData()
            meta.bind = engine

            table = Table(
                table_name,
                meta,
                Column("id", Integer, primary_key=True),
                Column("a", Integer),
                Column("c", String(256)),
            )
            table.create()

            # check missing shadow table
            self.assertRaises(NoSuchTableError, utils.check_shadow_table, engine, table_name)

            shadow_table = Table(
                db._SHADOW_TABLE_PREFIX + table_name, meta, Column("id", Integer), Column("a", Integer)
            )
            shadow_table.create()

            # check missing column
            self.assertRaises(exception.NovaException, utils.check_shadow_table, engine, table_name)

            # check when all is ok
            c = Column("c", String(256))
            shadow_table.create_column(c)
            self.assertTrue(utils.check_shadow_table(engine, table_name))

            # check extra column
            d = Column("d", Integer)
            shadow_table.create_column(d)
            self.assertRaises(exception.NovaException, utils.check_shadow_table, engine, table_name)

            table.drop()
            shadow_table.drop()
コード例 #26
0
ファイル: test_migration_utils.py プロジェクト: Redosen/nova
    def test_create_shadow_table_not_supported_type(self):
        if 'sqlite' in self.engines:
            table_name = 'test_create_shadow_table_not_supported_type'
            engine = self.engines['sqlite']
            meta = MetaData()
            meta.bind = engine
            table = Table(table_name, meta,
                          Column('id', Integer, primary_key=True),
                          Column('a', CustomType))
            table.create()

            # reflection of custom types has been fixed upstream
            if SA_VERSION < (0, 9, 0):
                self.assertRaises(exception.NovaException,
                                  utils.create_shadow_table,
                                  engine, table_name=table_name)

            shadow_table = utils.create_shadow_table(engine,
                table_name=table_name,
                a=Column('a', CustomType())
            )
            self.assertTrue(utils.check_shadow_table(engine, table_name))
            table.drop()
            shadow_table.drop()
コード例 #27
0
ファイル: test_migrations.py プロジェクト: RibeiroAna/nova
 def _post_downgrade_231(self, engine):
     self.assertColumnNotExists(engine, 'instances', 'ephemeral_key_uuid')
     self.assertTrue(db_utils.check_shadow_table(engine, 'instances'))
コード例 #28
0
 def _post_downgrade_231(self, engine):
     self.assertColumnNotExists(engine, 'instances', 'ephemeral_key_uuid')
     self.assertTrue(db_utils.check_shadow_table(engine, 'instances'))