tests/store/base.py tests should work with foreign key constraints

Bug #224784 reported by James Henstridge on 2008-04-30
2
Affects Status Importance Assigned to Milestone
Storm
Undecided
Unassigned

Bug Description

The store tests in tests/store/base.py make use of a number of tables. Conceptually there are relationships between these tables, but no foreign key constraints are set up for the PostgreSQL or MySQL versions of the tests. Without the foreign key constraints, tests may pass when there are bugs in the flush order (e.g. adding a record before the record it references, etc).

Unfortunately, the tests do not pass when the obvious constraints are added. Problems include:

 * deleting rows of the "foo" or "bar" tables when there are outstanding references.
 * setting foreign keys to invalid values (a few of the tests do this on purpose to test the behaviour though, so it isn't clear cut).
 * changing the meaning of a foreign key column (e.g. test_reference_self() using bar.foo_id as a reference to bar).

It'd be good to have these tests use appropriate tables. We probably need:
 1. a table without references to be used for most single-table tests.
 2. an example of a standard foreign key reference
 3. the same as (2) but without an actual FK reference. This could be another column on the table from (2).
 4. the current "link" table but with FKs to "foo" and "bar". Do any tests depend on missing FKs here?
 5. a table with a self reference.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers