summaryrefslogtreecommitdiffstats
path: root/tests/test_sql_upgrade.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-01-17 06:19:03 +0000
committerGerrit Code Review <review@openstack.org>2013-01-17 06:19:03 +0000
commit8748cfa3a6b7573550e7ec8ced87e6fd2096a628 (patch)
tree28bdfece982399155d71d282378dee00c53ee034 /tests/test_sql_upgrade.py
parent9907ab59a0138c2d1aa00552feb51a259bb519f3 (diff)
parentf6b133d1eedac401b4fde51ebea94dab9019a4fe (diff)
downloadkeystone-8748cfa3a6b7573550e7ec8ced87e6fd2096a628.tar.gz
keystone-8748cfa3a6b7573550e7ec8ced87e6fd2096a628.tar.xz
keystone-8748cfa3a6b7573550e7ec8ced87e6fd2096a628.zip
Merge "Test that you can undo & re-apply all migrations"
Diffstat (limited to 'tests/test_sql_upgrade.py')
-rw-r--r--tests/test_sql_upgrade.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_sql_upgrade.py b/tests/test_sql_upgrade.py
index 156b420a..88eaaa8a 100644
--- a/tests/test_sql_upgrade.py
+++ b/tests/test_sql_upgrade.py
@@ -81,6 +81,20 @@ class SqlUpgradeTests(test.TestCase):
version = migration.db_version()
self.assertEqual(version, 0, "DB is at version 0")
+ def test_two_steps_forward_one_step_back(self):
+ """You should be able to cleanly undo a re-apply all upgrades.
+
+ Upgrades are run in the following order::
+
+ 0 -> 1 -> 0 -> 1 -> 2 -> 1 -> 2 -> 3 -> 2 -> 3 ...
+ ^---------^ ^---------^ ^---------^
+
+ """
+ for x in range(1, self.max_version + 1):
+ self.upgrade(x)
+ self.downgrade(x - 1)
+ self.upgrade(x)
+
def assertTableColumns(self, table_name, expected_cols):
"""Asserts that the table contains the expected set of columns."""
table = self.select_table(table_name)