Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#14799 closed (fixed)

Test database creation order problem after r14696

Reported by: Russell Keith-Magee Owned by: Russell Keith-Magee
Component: Testing framework Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

r14696 added a fix for #14415, changing the way test databases are created to ensure that the test setup/teardown process doesn't accidentally destroy the original source database.

However, in the process, it made the test database creation order subject to dictionary ordering. This is problematic because some database have dependencies on other databases during creation.

For example, Django's own test suite won't run if 'other' is created before 'default' because the post_syncdb signal causes a ContentTypes query to be issued, which will try to execute on the default database. If the default database hasn't been created, an error arises.

This is currently causing the buildbots to fail for Postgres.

Attachments (1)

t14799.diff (2.7 KB ) - added by Russell Keith-Magee 13 years ago.
Draft fix for problem.

Download all attachments as: .zip

Change History (7)

by Russell Keith-Magee, 13 years ago

Attachment: t14799.diff added

Draft fix for problem.

comment:1 by Russell Keith-Magee, 13 years ago

Has patch: set
Owner: changed from nobody to Russell Keith-Magee
Patch needs improvement: set
Status: newassigned
Triage Stage: UnreviewedAccepted

Here's a draft fix for the problem -- it introduces the concept of TEST_DEPENDENCIES, so you can specify which databases must be synchronized before others. By default, every database is assumed to be dependent on 'default' (except, of course, for default itself). This seems to be enough to make Django's test suite run.

comment:2 by Jacob, 13 years ago

(In [14756]) Ensured that the test suite creates the default DB before any others.

Refs #14799. Technically this fixes the problem, but I'm far from convinced
it's the perfect solution, so I'm leaving the ticket open. I'm committing
this now because it's the minimum required to get the test suite running
again, but this commit can -- and probably should -- be reverted in favor of
a more holistic fix later on.

comment:3 by Jacob, 13 years ago

(In [14757]) [1.2.X] Ensured that the test suite creates the default DB before any others.

Refs #14799. Backport of [14756], and see the note there for a caveat.

comment:4 by Russell Keith-Magee, 13 years ago

Resolution: fixed
Status: assignedclosed

(In [14822]) Fixed #14799 -- Provided a full solution for test database creation order problems.

comment:5 by Russell Keith-Magee, 13 years ago

(In [14825]) [1.2.X] Fixed #14799 -- Provided a full solution for test database creation order problems.

Backport of r14822, r14823 and r14824 from trunk.

comment:6 by Jacob, 12 years ago

milestone: 1.3

Milestone 1.3 deleted

Note: See TracTickets for help on using tickets.
Back to Top