summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorElena Ezhova <eezhova@mirantis.com>2013-08-05 11:05:07 +0400
committerElena Ezhova <eezhova@mirantis.com>2013-08-12 12:19:11 +0400
commit0623b291ef4eb9357ea502166c55515ebcc99760 (patch)
treeef481182464d73f4975747ee46f952df8972321e /tests
parent21389a30011bda8233b1f5f2b4469a453246d4ef (diff)
downloadkeystone-0623b291ef4eb9357ea502166c55515ebcc99760.tar.gz
keystone-0623b291ef4eb9357ea502166c55515ebcc99760.tar.xz
keystone-0623b291ef4eb9357ea502166c55515ebcc99760.zip
Drop extra credential indexes
For mysql ForeignKey constraints were removed but the fields stayed as indexes. This migration drops them. bp db-sync-models-with-migrations Change-Id: I3baeac4047cd65ac5d7733ba909c45d0874f17d8
Diffstat (limited to 'tests')
-rw-r--r--tests/test_sql_upgrade.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_sql_upgrade.py b/tests/test_sql_upgrade.py
index ed00deae..e6d6162b 100644
--- a/tests/test_sql_upgrade.py
+++ b/tests/test_sql_upgrade.py
@@ -1162,6 +1162,24 @@ class SqlUpgradeTests(test.TestCase):
self.assertEqual(cred.user_id,
ec2_credential['user_id'])
+ def test_drop_credential_indexes(self):
+ self.upgrade(31)
+ table = sqlalchemy.Table('credential', self.metadata, autoload=True)
+ self.assertEqual(len(table.indexes), 0)
+
+ def test_downgrade_30(self):
+ self.upgrade(31)
+ self.downgrade(30)
+ table = sqlalchemy.Table('credential', self.metadata, autoload=True)
+ index_data = [(idx.name, idx.columns.keys())
+ for idx in table.indexes]
+ if self.engine.name == 'mysql':
+ self.assertIn(('user_id', ['user_id']), index_data)
+ self.assertIn(('credential_project_id_fkey', ['project_id']),
+ index_data)
+ else:
+ self.assertEqual(len(index_data), 0)
+
def populate_user_table(self, with_pass_enab=False,
with_pass_enab_domain=False):
# Populate the appropriate fields in the user