Opened 8 years ago

Closed 8 years ago

#14443 closed (wontfix)

Oracle backend returns wrong test database name

Reported by: Filip Gruszczyński Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


While working on #14415 I have noticed that method _create_test_db in DatabaseCreation consistently returns either TEST_NAME or 'test_' + NAME , but this class for Oracle returns self.connection.settings_dict['NAME'] . Is that corrent? I am posting a one line patch, that returns proper value.

Attachments (1)

14443.patch (597 bytes) - added by Filip Gruszczyński 8 years ago.

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by Filip Gruszczyński

Attachment: 14443.patch added

comment:1 Changed 8 years ago by Filip Gruszczyński

Has patch: set

comment:2 Changed 8 years ago by Ramiro Morales

Triage Stage: UnreviewedAccepted

In the days when the 1.1 release was near there was some work in this area of the code. Please see changesets r10547 and r10608 and its associated ticket: #10716 (also, r8330 from the 1.0 development cycle). Note how some attempts to rationalize things that arose from simple code inspection had to be undone

IMHO, certainly it would be helpful if somebody with a) access to a working Oracle setup, b) Oracle experience and c) time do dedicate to the task could make and test a holistic review and cleanup of the code. I can submit the resulting patch for review by the Oracle experts in the core development team and commit it if all goes ok.

a) and b) are critical because AFAIK e.g. the Django test suite is running now under Oracle in these conditions and we don be the ones that break it, aren't we :)

comment:3 Changed 8 years ago by Ramiro Morales

Resolution: wontfix
Status: newclosed

After learning a bit about how the Oracle backend handles the test environment preparation, I've found this:

  • The backend implements its own tablespace-based scheme (not a database-based one) so the value returned by DatabaseCreation._create_test_db() isn't really the one used to create/remove any test database like is done by the other Django DB backends. For more details please refer to the wiki:OracleTestSetup document (Understanding the database test setup section.)
  • This changes actually breaks test environment setup, because the backend actually tries to connect to the DB returned by this method:
Creating test database 'default'...
Creating test user...
Creating test database 'other'...
Creating test user...
Traceback (most recent call last):
  File "./", line 314, in <module>
    failures = django_tests(int(options.verbosity), options.interactive, options.failfast, args)
  File "./", line 183, in django_tests
    failures = test_runner.run_tests(test_labels, extra_tests=extra_tests)
  File "django/final/django/test/", line 276, in run_tests
    old_config = self.setup_databases()
  File "django/final/django/test/", line 232, in setup_databases
    connection.creation.create_test_db(self.verbosity, autoclobber=not self.interactive)
  File "django/final/django/db/backends/", line 352, in create_test_db
  File "django/final/django/db/backends/", line 169, in confirm
    self.supports_transactions = self._supports_transactions()
  File "django/final/django/db/backends/", line 174, in _supports_transactions
    cursor = self.connection.cursor()
  File "django/final/django/db/backends/", line 77, in cursor
    cursor = self._cursor()
  File "django/final/django/db/backends/oracle/", line 367, in _cursor
    self.connection = Database.connect(conn_string, **self.settings_dict['OPTIONS'])
cx_Oracle.DatabaseError: ORA-12154: TNS:could not resolve the connect identifier specified

So, I'm going to close this ticket, please reopen it if you further Oracle and Oracle backend hindsight and can implement the proposed change but accompanied by others so the above breakage doesn't happen.

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