summaryrefslogtreecommitdiffstats
path: root/tests/test_sql_upgrade.py
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2012-12-20 18:56:06 -0500
committerAdam Young <ayoung@redhat.com>2013-01-16 16:18:24 -0500
commited252e0f92f0750a2f35871d72e52a2767569bef (patch)
tree20a308867e42b0b3eb886dac2584780d0de10a32 /tests/test_sql_upgrade.py
parentacc810da672912bf3e5b730f89f0108adadda65e (diff)
downloadkeystone-ed252e0f92f0750a2f35871d72e52a2767569bef.tar.gz
keystone-ed252e0f92f0750a2f35871d72e52a2767569bef.tar.xz
keystone-ed252e0f92f0750a2f35871d72e52a2767569bef.zip
Allow running of sql against the live DB.
Reordered the tables in the domain downgrade script to avoid breaking the integrity constraints To run the test: ./run_tests.sh -N test_sql_upgrade This version removed all of the code specific to running against a live DB and merged it into the standard tests. Fixed a couple downgrade functions that were failing. They had not been tested Change-Id: Ie1214e5543bd08fde95652af2464cc9c80db449d
Diffstat (limited to 'tests/test_sql_upgrade.py')
-rw-r--r--tests/test_sql_upgrade.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/test_sql_upgrade.py b/tests/test_sql_upgrade.py
index 090756e0..44103888 100644
--- a/tests/test_sql_upgrade.py
+++ b/tests/test_sql_upgrade.py
@@ -13,7 +13,18 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
-
+"""
+To run these tests against a live database:
+1. Modify the file `tests/backend_sql.conf` to use the connection for your
+ live database
+2. Set up a blank, live database.
+3. run the tests using
+ ./run_tests.sh -N test_sql_upgrade
+ WARNING::
+ Your database will be wiped.
+ Do not do this against a Database with valuable data as
+ all data will be lost.
+"""
import copy
import json
import uuid
@@ -54,6 +65,10 @@ class SqlUpgradeTests(test.TestCase):
self.repo_path, 0)
def tearDown(self):
+ table = sqlalchemy.Table("migrate_version", self.metadata,
+ autoload=True)
+ self.downgrade(0)
+ table.drop(self.engine, checkfirst=True)
super(SqlUpgradeTests, self).tearDown()
def test_blank_db_to_start(self):