Module Import alias Import alias Import alias ImportFrom alias ImportFrom alias identifier ImportFrom alias ImportFrom alias identifier ImportFrom alias ImportFrom alias identifier ImportFrom alias identifier Import alias ImportFrom alias identifier ImportFrom alias ImportFrom alias Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore AttributeLoad NameLoad attr ClassDef bases NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Str Assign AttributeStore NameLoad attr NameLoad FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Str Call NameLoad AttributeLoad NameLoad attr keyword Str keyword NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults vararg kwarg body Expr Str Assign AttributeStore AttributeLoad NameLoad attr attr NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Call NameLoad AttributeLoad NameLoad attr keyword Str keyword NameLoad Expr Call AttributeLoad NameLoad attr Expr Call Call NameLoad NameLoad NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr keyword NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Assign NameStore ListLoad For NameStore Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr TryFinally body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore BoolOpOr Call AttributeLoad NameLoad attr Str finalbody Expr Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore NameLoad TryExcept body If NameLoad body Assign NameStore NameLoad Assign NameStore Call NameLoad NameLoad BinOpMod Str NameLoad NameLoad If NameLoad body Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad If NameLoad body Assign NameStore Call NameLoad NameLoad BinOpMod Str NameLoad NameLoad If NameLoad body Expr Call NameLoad NameLoad NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Call NameLoad Str attr keyword NameLoad keyword NameLoad Raise decorator_list decorator_list ClassDef bases AttributeLoad NameLoad attr body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Str Assign AttributeStore NameLoad attr NameLoad FunctionDef arguments args NameParam defaults body Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr Str Call NameLoad AttributeLoad NameLoad attr keyword Str keyword NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam defaults body Return AttributeLoad AttributeLoad NameLoad attr attr decorator_list decorator_list
N/A N/A io N/A os N/A alembic alembic command alembic config alembic_config alembic migration alembic script alembic_script oslo_config cfg oslo_db.sqlalchemy test_migrations t_m oslo_log log logging N/A sahara.db.migration sahara.db.sqlalchemy api sa sahara.db.sqlalchemy model_base sahara.i18n _LE N/A LOG N/A N/A logging getLogger __name__ N/A CONF N/A cfg CONF BaseWalkMigrationTestCase N/A object N/A N/A ALEMBIC_CONFIG N/A N/A alembic_config Config N/A N/A N/A os path join N/A N/A N/A os path dirname N/A N/A N/A sahara db migration __file__ alembic.ini N/A N/A ALEMBIC_CONFIG sahara_config CONF _configure N/A N/A self engine N/A N/A N/A For each type of repository we should do some of configure steps.

        For migrate_repo we should set under version control our database.
        For alembic we should configure database settings. For this goal we
        should use oslo_config and openstack.commom.db.sqlalchemy.session with
        database functionality (reset default settings and session cleanup).
         N/A N/A N/A CONF set_override connection N/A str N/A engine url group database enforce_type True N/A N/A N/A sa cleanup N/A _alembic_command N/A N/A self alembic_command engine N/A args kwargs N/A N/A Most of alembic command return data into output.

        We should redefine this setting for getting info.
         N/A N/A N/A self ALEMBIC_CONFIG stdout buf N/A N/A io StringIO N/A N/A N/A CONF set_override connection N/A str N/A engine url group database enforce_type True N/A N/A N/A sa cleanup N/A N/A N/A getattr command alembic_command args kwargs N/A res N/A N/A N/A N/A buf getvalue strip N/A N/A N/A LOG debug N/A N/A Alembic command {command} returns: {result} format command alembic_command result res N/A N/A N/A sa cleanup N/A res N/A _get_versions N/A N/A self N/A N/A N/A Stores a list of versions.

        Since alembic version has a random algorithm of generation
        (SA-migrate has an ordered autoincrement naming) we should store
        a list of versions (version for upgrade)
        for successful testing of migrations in up mode.
         N/A env N/A N/A N/A alembic_script ScriptDirectory from_config N/A self ALEMBIC_CONFIG N/A versions N/A N/A rev N/A N/A env walk_revisions N/A N/A N/A N/A versions append N/A rev revision N/A N/A N/A versions reverse N/A versions N/A walk_versions N/A N/A self engine N/A None N/A N/A N/A N/A self _configure engine N/A versions N/A N/A self _get_versions N/A ver versions N/A N/A N/A N/A self _migrate_up engine ver with_data True N/A _get_version_from_db N/A N/A self engine N/A N/A N/A Returns latest version from db for each type of migrate repo. N/A conn N/A N/A engine connect N/A N/A N/A context N/A N/A N/A migration MigrationContext configure conn N/A version N/A N/A N/A context get_current_revision -1 N/A N/A N/A N/A conn close N/A version N/A _migrate N/A N/A self engine version cmd N/A N/A N/A Base method for manipulation with migrate repo.

        It will upgrade or downgrade the actual database.
         N/A N/A N/A self _alembic_command cmd engine N/A self ALEMBIC_CONFIG version N/A _migrate_up N/A N/A self engine version with_data N/A False N/A N/A migrate up to a new version of the db.

        We allow for data insertion and post checks at every
        migration version with special _pre_upgrade_### and
        _check_### functions in the main test.
         N/A check_version version N/A N/A N/A with_data N/A N/A data None N/A pre_upgrade N/A getattr self N/A _pre_upgrade_%s check_version None N/A pre_upgrade N/A N/A data N/A pre_upgrade engine N/A N/A N/A self _migrate engine version upgrade N/A N/A N/A self assertEqual version N/A N/A self _get_version_from_db engine N/A with_data N/A N/A check N/A getattr self N/A _check_%s check_version None N/A check N/A N/A N/A check engine data N/A N/A N/A Exception N/A N/A N/A N/A LOG error N/A N/A N/A _LE Failed to migrate to version {version} on engine {engine} format version version engine engine N/A N/A N/A TestModelsMigrationsSync N/A N/A t_m ModelsMigrationsSync N/A N/A Class for comparison of DB migration scripts and models.

    Allows to check if the DB schema obtained by applying of migration
    scripts is equal to the one produced from models definitions.
     N/A ALEMBIC_CONFIG N/A N/A alembic_config Config N/A N/A N/A os path join N/A N/A N/A os path dirname N/A N/A N/A sahara db migration __file__ alembic.ini N/A N/A ALEMBIC_CONFIG sahara_config CONF get_engine N/A N/A self N/A N/A N/A N/A self engine N/A db_sync N/A N/A self engine N/A N/A N/A N/A N/A CONF set_override connection N/A str N/A engine url group database enforce_type True N/A N/A N/A N/A alembic command upgrade N/A self ALEMBIC_CONFIG head N/A get_metadata N/A N/A self N/A N/A N/A N/A N/A model_base SaharaBase metadata N/A N/A