Opened 19 months ago

Last modified 19 months ago

#19542 new Bug

Testing with Oracle: mirror databases do not work

Reported by: shai Owned by: nobody
Component: Testing framework Version: 1.4
Severity: Normal Keywords: oracle
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


By "mirror databases" I here mean two related cases:

  1. A database is explicitly designated as "TEST_MIRROR" of another
  2. A database is implicitly a test mirror of another, because they have the same essential parameters

In these cases, the test framework needs to do things a little differently -- create only one database, and make all relevant connections refer to it.

This breaks with Oracle, because setting up test databases there is different from elsewhere. Quoting myself,

The root of the problem is that unlike the other DBMSs, where you can create a new database for testing, Oracle does not have the concept of separate databases within the same server. So, to have a clean schema to work in, the test framework creates a new user (in Oracle there's also a 1-1 correspondence between users and schemas) when it creates the test database.

This is all done in the backend-specific _create_test_db(). The problem is that this code only takes care of a single db (naturally). There is generic code (in DjangoTestSuiteRunner.setup_databases()), that takes care of multiple dbs -- including [...] mirrors. This code isn't aware of the Oracle-specific settings changes. To handle mirrors, it just updates the database name of the mirror to the one set by _create_test_db(). In the Oracle case, this is a no-op (self.connection.settings_dict['NAME'] is not changed); and nobody is left to update the user, password and tablespace parameters, which the backend does change.

Anssi Kääriäinen added that the "guilty" line seems to be line 321 of django/test/

Attachments (0)

Change History (2)

comment:1 Changed 19 months ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 19 months ago by aaugustin

  • Keywords oracle added

Add Comment

Modify Ticket

Change Properties
<Author field>
as new
The owner will be changed from nobody to anonymous. Next status will be 'assigned'
as The resolution will be set. Next status will be 'closed'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.