Permalink
Browse files

Merge "Test that you can undo & re-apply all migrations"

  • Loading branch information...
Jenkins authored and openstack-gerrit committed Jan 17, 2013
2 parents 9907ab5 + f6b133d commit 8748cfa3a6b7573550e7ec8ced87e6fd2096a628
Showing with 14 additions and 0 deletions.
  1. +14 −0 tests/test_sql_upgrade.py
View
@@ -81,6 +81,20 @@ def test_start_version_0(self):
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)

0 comments on commit 8748cfa

Please sign in to comment.