Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit ed252e0f92f0750a2f35871d72e52a2767569bef 1 parent acc810d
authored December 20, 2012
4  tests/backend_sql.conf
... ...
@@ -1,5 +1,9 @@
1 1
 [sql]
2 2
 connection = sqlite://
  3
+#To Test MySQL:
  4
+#connection = mysql://root:keystone@localhost/keystone?charset=utf8
  5
+#To Test PostgreSQL:
  6
+#connection = postgresql://keystone:keystone@localhost/keystone?client_encoding=utf8
3 7
 idle_timeout = 200
4 8
 
5 9
 [identity]
17  tests/test_sql_upgrade.py
@@ -13,7 +13,18 @@
13 13
 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 14
 # License for the specific language governing permissions and limitations
15 15
 # under the License.
16  
-
  16
+"""
  17
+To run these tests against a live database:
  18
+1. Modify the file `tests/backend_sql.conf` to use the connection for your
  19
+   live database
  20
+2. Set up a blank, live database.
  21
+3. run the tests using
  22
+    ./run_tests.sh -N  test_sql_upgrade
  23
+    WARNING::
  24
+        Your database will be wiped.
  25
+    Do not do this against a Database with valuable data as
  26
+    all data will be lost.
  27
+"""
17 28
 import copy
18 29
 import json
19 30
 import uuid
@@ -54,6 +65,10 @@ def setUp(self):
54 65
                                                              self.repo_path, 0)
55 66
 
56 67
     def tearDown(self):
  68
+        table = sqlalchemy.Table("migrate_version", self.metadata,
  69
+                                 autoload=True)
  70
+        self.downgrade(0)
  71
+        table.drop(self.engine, checkfirst=True)
57 72
         super(SqlUpgradeTests, self).tearDown()
58 73
 
59 74
     def test_blank_db_to_start(self):

Git Notes

review

Verified+2: Jenkins
Approved+1: Dolph Mathews <dolph.mathews@gmail.com>
Code-Review+2: Dolph Mathews <dolph.mathews@gmail.com>
Verified+1: SmokeStack
Code-Review+2: henry-nash <henryn@linux.vnet.ibm.com>
Submitted-by: Jenkins
Submitted-at: Wed, 16 Jan 2013 22:55:46 +0000
Reviewed-on: https://review.openstack.org/18519
Project: openstack/keystone
Branch: refs/heads/master

0 notes on commit ed252e0

Please sign in to comment.
Something went wrong with that request. Please try again.