Implement additional test for db migrations

Currently Manila unit tests doesn't check how many
branches exist in db migrations, but this is extremely
important, because multiple branches break
'manila db sync' command.

Implement test, which checks that db migrations has
only one branch.

Change-Id: I4125500126ba46594a636fea38480abd0c97b519
This commit is contained in:
Igor Malinovskiy 2015-02-04 12:05:05 +02:00
parent 8412517852
commit 8c75493ebd
1 changed files with 9 additions and 0 deletions

View File

@ -149,6 +149,15 @@ class ManilaMigrationsCheckers(test_migrations.WalkVersionsMixin):
self._walk_versions(snake_walk=self.snake_walk,
downgrade=self.downgrade)
def test_single_branch(self):
alembic_cfg = migration._alembic_config()
script_directory = script.ScriptDirectory.from_config(alembic_cfg)
actual_result = script_directory.get_heads()
self.assertEqual(1, len(actual_result),
"Db migrations should have only one branch.")
class TestManilaMigrationsMySQL(ManilaMigrationsCheckers,
test_base.MySQLOpportunisticTestCase):