unit tests don't enable Foreign Key for Sqlite
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Identity (keystone) |
Fix Released
|
Medium
|
wangxiyuan |
Bug Description
Now Keystone runs unit test with sqlite backend by default. But sqlite doesn't enable Foreign Key function by default.
It means that we lost the case for all FK related test.
Even after enabled FK for the test. There still some problems:
1. We lost root domain (<<keystone.
2. Some tests, such as test_sql_upgrade and identity.
So we should refactor our test code to satisfy sqilte FK function.
There are some steps:
1. Add FK support for the tests. Disable it by default
2. Enable FK for the test one by one.
3. Make sure the Fk is disabled for test_sql_upgrade and identity.
Changed in keystone: | |
assignee: | nobody → wangxiyuan (wangxiyuan) |
status: | New → In Progress |
description: | updated |
description: | updated |
Changed in keystone: | |
importance: | Undecided → Medium |
Changed in keystone: | |
assignee: | wangxiyuan (wangxiyuan) → Morgan Fainberg (mdrnstm) |
tags: | added: test-improvement |
Changed in keystone: | |
assignee: | wangxiyuan (wangxiyuan) → Lance Bragstad (lbragstad) |
Changed in keystone: | |
assignee: | Lance Bragstad (lbragstad) → wangxiyuan (wangxiyuan) |
Changed in keystone: | |
assignee: | wangxiyuan (wangxiyuan) → Lance Bragstad (lbragstad) |
Changed in keystone: | |
assignee: | Lance Bragstad (lbragstad) → wangxiyuan (wangxiyuan) |
Changed in keystone: | |
assignee: | wangxiyuan (wangxiyuan) → Lance Bragstad (lbragstad) |
Changed in keystone: | |
assignee: | Lance Bragstad (lbragstad) → wangxiyuan (wangxiyuan) |
Changed in keystone: | |
milestone: | none → stein-2 |
milestone: | stein-2 → stein-1 |
Reviewed: https:/ /review. openstack. org/126030 /git.openstack. org/cgit/ openstack/ keystone/ commit/ ?id=ed2b65a5ddc 8536470797c3946 7b20e934b02dc0
Committed: https:/
Submitter: Zuul
Branch: master
commit ed2b65a5ddc8536 470797c39467b20 e934b02dc0
Author: David Stanek <email address hidden>
Date: Fri Oct 3 18:22:41 2014 +0000
Force SQLite to properly deal with foreign keys
This will help with testing since SQLite will start enforcing the
foreign key relationships.
We will still have a problem with migrations for tables that refer to
each other. SQLite can't alter tables and sqlalchemy-migrates tmp table
strategy for migrations fails in this situation.
This patch did: backens. test_sql
1. Add FK support for the tests. Disable it by default.
2. Make sure the Fk is disabled for test_sql_upgrade and
identity.
Partial-Bug: #1744195
Co-Authored-By: wangxiyuan<email address hidden> cb2c54215d54491 665db1caa22
Change-Id: I276af7c0125dc2