Comment 13 for bug 1744195

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

Reviewed: https://review.openstack.org/558193
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=012dac29b8dd6ac77e707f916fc4c0ca57d58b14
Submitter: Zuul
Branch: master

commit 012dac29b8dd6ac77e707f916fc4c0ca57d58b14
Author: wangxiyuan <email address hidden>
Date: Mon Apr 2 19:28:33 2018 +0800

    Enable foreign keys for unit test

    The unit test uses sqlite for test which closes db foreign keys
    function by default. This patch enabled the sqlite foreign keys
    function for unit test by default.

    The "project" table is a self referencing FK table(id <-> domain_id
    column). So when the FK is enabled, there must exists a root record
    before insert data to this table. It's <<keystone.domain.root>>.

    Usually, the <<keystone.domain.root>> recored is inserted into the
    table once operators run "keystone-manage db_sync" command when
    deploy Keystone. But the unit test code doesn't run this command,
    it initialise the db schema by reading sqlalchemy object model, so
    the <<keystone.domain.root>> record is missed. Then we can't create
    any project record, it'll raise FK error.

    So in this patch, before creating any projects in the test, we must
    ensure the <<keystone.domain.root>> record exists first.

    Change-Id: I565d12395ca39a58ba90faf8641a9e02d986aeb9
    Closes-Bug: #1744195