The ironic.tests.unit.db.sqlalchemy.test_migrations Module

Tests for database migrations. There are “opportunistic” tests for both mysql and postgresql in here, which allows testing against these databases in a properly configured unit test environment.

For the opportunistic testing you need to set up a db named ‘openstack_citest’ with user ‘openstack_citest’ and password ‘openstack_citest’ on localhost. The test will then use that db and u/p combo to run the tests.

For postgres on Ubuntu this can be done with the following commands:

sudo -u postgres psql
postgres=# create user openstack_citest with createdb login password
     'openstack_citest';
postgres=# create database openstack_citest with owner openstack_citest;
class ironic.tests.unit.db.sqlalchemy.test_migrations.MigrationCheckersMixin[source]

Bases: object

setUp()[source]
test_create_schema_and_version()[source]
test_upgrade_and_create_schema()[source]
test_upgrade_and_version()[source]
test_upgrade_twice()[source]
test_walk_versions()[source]
class ironic.tests.unit.db.sqlalchemy.test_migrations.ModelsMigrationSyncMixin[source]

Bases: object

db_sync(engine)[source]
get_engine()[source]
get_metadata()[source]
setUp()[source]
class ironic.tests.unit.db.sqlalchemy.test_migrations.ModelsMigrationsSyncMysql(*args, **kwds)[source]

Bases: ironic.tests.unit.db.sqlalchemy.test_migrations.ModelsMigrationSyncMixin, oslo_db.sqlalchemy.test_migrations.ModelsMigrationsSync, oslo_db.tests.sqlalchemy.base.MySQLOpportunisticTestCase

class ironic.tests.unit.db.sqlalchemy.test_migrations.ModelsMigrationsSyncPostgres(*args, **kwds)[source]

Bases: ironic.tests.unit.db.sqlalchemy.test_migrations.ModelsMigrationSyncMixin, oslo_db.sqlalchemy.test_migrations.ModelsMigrationsSync, oslo_db.tests.sqlalchemy.base.PostgreSQLOpportunisticTestCase

class ironic.tests.unit.db.sqlalchemy.test_migrations.TestMigrationsMySQL(*args, **kwds)[source]

Bases: ironic.tests.unit.db.sqlalchemy.test_migrations.MigrationCheckersMixin, ironic.tests.unit.db.sqlalchemy.test_migrations.WalkVersionsMixin, oslo_db.tests.sqlalchemy.base.MySQLOpportunisticTestCase

class ironic.tests.unit.db.sqlalchemy.test_migrations.TestMigrationsPostgreSQL(*args, **kwds)[source]

Bases: ironic.tests.unit.db.sqlalchemy.test_migrations.MigrationCheckersMixin, ironic.tests.unit.db.sqlalchemy.test_migrations.WalkVersionsMixin, oslo_db.tests.sqlalchemy.base.PostgreSQLOpportunisticTestCase

class ironic.tests.unit.db.sqlalchemy.test_migrations.TestWalkVersions(*args, **kwargs)[source]

Bases: ironic.tests.base.TestCase, ironic.tests.unit.db.sqlalchemy.test_migrations.WalkVersionsMixin

setUp()[source]
test_migrate_up()[source]
test_migrate_up_with_data()[source]
test_walk_versions_all_default(*args, **keywargs)[source]
test_walk_versions_all_false(*args, **keywargs)[source]
class ironic.tests.unit.db.sqlalchemy.test_migrations.WalkVersionsMixin[source]

Bases: object