IntegrityError running sql tests on MySQL/Postgres

Bug #1169381 reported by Jamie Lennox
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Medium
Jamie Lennox

Bug Description

When running tests/test_sql_upgrade.py against a MySQL or Postgres database the tests fail with an IntegrityError.

see: http://paste.openstack.org/show/36045/

It appears that this is because migration 020 imposes a foreign key restraint in downgrade that wasn't initially present.

Printing the table structure of 'metadata' before migration 020 gives:

Table('metadata', MetaData(bind=Engine(mysql://root:test@localhost/keystonetest?charset=utf8)),
Column(u'user_id', VARCHAR(length=64), table=<metadata>, primary_key=True, nullable=False),
Column(u'tenant_id', VARCHAR(length=64), table=<metadata>, primary_key=True, nullable=False),
Column(u'data', MEDIUMTEXT(), table=<metadata>), schema=None)

Printing the table structure of 'metadata' after migration 020 downgrade gives:

Table('metadata', MetaData(bind=Engine(mysql://root:test@localhost/keystonetest?charset=utf8)),
Column('user_id', String(length=64), ForeignKey('user.id'), table=<metadata>, primary_key=True, nullable=False),
Column('tenant_id', String(length=64), table=<metadata>, primary_key=True, nullable=False),
Column('data', Text(), table=<metadata>), schema=None)

This is not relevant to whether user_id should be a foreign key, simply that the downgrade does not match the upgrade.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

Fix proposed to branch: master
Review: https://review.openstack.org/26985

Changed in keystone:
assignee: nobody → Jamie Lennox (jamielennox)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/26985
Committed: http://github.com/openstack/keystone/commit/2eab5fd2b7f980d355caa53be582aa07dc65a8e2
Submitter: Jenkins
Branch: master

commit 2eab5fd2b7f980d355caa53be582aa07dc65a8e2
Author: Jamie Lennox <email address hidden>
Date: Tue Apr 16 13:14:21 2013 +1000

    Remove new constraint from migration downgrade.

    Remove the foreign key constraint for user_id. Whilst it is a foreign
    key the constraint was not set in the previous schema. Also sets the
    columns names to unicode as they were in previous schema.

    Fixes: bug 1169381
    Change-Id: I9b1ac5305622d68a7e124ba8100a4b8166b43af0

Changed in keystone:
status: In Progress → Fix Committed
Dolph Mathews (dolph)
tags: added: grizzly-backport-potential
Revision history for this message
Brant Knudson (blk-u) wrote :

This introduced or exposed a problem with sqlite testing: https://bugs.launchpad.net/keystone/+bug/1179259

Thierry Carrez (ttx)
Changed in keystone:
milestone: none → havana-1
status: Fix Committed → Fix Released
Dolph Mathews (dolph)
Changed in keystone:
importance: Undecided → Medium
Thierry Carrez (ttx)
Changed in keystone:
milestone: havana-1 → 2013.2
Alan Pevec (apevec)
tags: removed: grizzly-backport-potential
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.