summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-01-26 16:39:02 +0000
committerGerrit Code Review <review@openstack.org>2015-01-26 16:39:02 +0000
commit1f6103e4ef68b2fece4b265996d859fe0159f4cc (patch)
tree30cffc510ccaf1d8b3d6751bdb7a1f8fbda97310
parentc0a43732e8a46c3e7fe4a0328aa3ed61239c0a1f (diff)
parentafcc3dfcd30ed8f7a03598c0ea1ed13015117635 (diff)
downloadoslo-db-1f6103e4ef68b2fece4b265996d859fe0159f4cc.tar.gz
Merge "Fix 0 version handling in migration_cli manager"
-rw-r--r--oslo_db/sqlalchemy/migration_cli/manager.py2
-rw-r--r--oslo_db/tests/sqlalchemy/test_migrate_cli.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/oslo_db/sqlalchemy/migration_cli/manager.py b/oslo_db/sqlalchemy/migration_cli/manager.py
index c8ab30e..bda3c2a 100644
--- a/oslo_db/sqlalchemy/migration_cli/manager.py
+++ b/oslo_db/sqlalchemy/migration_cli/manager.py
@@ -57,7 +57,7 @@ class MigrationManager(object):
last = None
for plugin in self._plugins:
version = plugin.version()
- if version:
+ if version is not None:
last = version
return last
diff --git a/oslo_db/tests/sqlalchemy/test_migrate_cli.py b/oslo_db/tests/sqlalchemy/test_migrate_cli.py
index c1ab53c..6ad693c 100644
--- a/oslo_db/tests/sqlalchemy/test_migrate_cli.py
+++ b/oslo_db/tests/sqlalchemy/test_migrate_cli.py
@@ -161,6 +161,7 @@ class TestMigrationManager(test_base.BaseTestCase):
self.migration_manager = manager.MigrationManager(
self.migration_config)
self.ext = mock.Mock()
+ self.ext.obj.version = mock.Mock(return_value=0)
self.migration_manager._manager.extensions = [self.ext]
super(TestMigrationManager, self).setUp()
@@ -180,6 +181,10 @@ class TestMigrationManager(test_base.BaseTestCase):
self.migration_manager.version()
self.ext.obj.version.assert_called_once_with()
+ def test_version_return_value(self):
+ version = self.migration_manager.version()
+ self.assertEqual(0, version)
+
def test_revision_message_autogenerate(self):
self.migration_manager.revision('test', True)
self.ext.obj.revision.assert_called_once_with('test', True)