[Django] #19542: Testing with Oracle: mirror databases do not work

28 views
Skip to first unread message

Django

unread,
Dec 30, 2012, 6:36:23 PM12/30/12
to django-...@googlegroups.com
#19542: Testing with Oracle: mirror databases do not work
-----------------------------------+--------------------
Reporter: shai | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.4
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------
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 [https://groups.google.com/d/msg/django-
developers/UrQ0Zlfx_rc/-exrMlEVAhkJ 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 [https://groups.google.com/d/msg/django-
developers/UrQ0Zlfx_rc/3UgRpQUk5aoJ added] that the "guilty" line seems to
be line 321 of `django/test/simple.py`.

--
Ticket URL: <https://code.djangoproject.com/ticket/19542>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 31, 2012, 2:41:27 PM12/31/12
to django-...@googlegroups.com
#19542: Testing with Oracle: mirror databases do not work
-----------------------------------+------------------------------------

Reporter: shai | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.4
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by aaugustin):

* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/19542#comment:1>

Django

unread,
Dec 31, 2012, 2:41:34 PM12/31/12
to django-...@googlegroups.com
#19542: Testing with Oracle: mirror databases do not work
-----------------------------------+------------------------------------

Reporter: shai | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.4
Severity: Normal | Resolution:
Keywords: oracle | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by aaugustin):

* keywords: => oracle


--
Ticket URL: <https://code.djangoproject.com/ticket/19542#comment:2>

Django

unread,
Jun 4, 2015, 7:57:50 AM6/4/15
to django-...@googlegroups.com
#19542: Testing with Oracle: mirror databases do not work
-----------------------------------+------------------------------------
Reporter: shai | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 1.4
Severity: Normal | Resolution: fixed

Keywords: oracle | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by shaib):

* status: new => closed
* resolution: => fixed


Comment:

Some time within the changes in test-runner, this seems to have been
resolved.

--
Ticket URL: <https://code.djangoproject.com/ticket/19542#comment:3>

Django

unread,
Jun 4, 2015, 10:09:18 AM6/4/15
to django-...@googlegroups.com
#19542: Testing with Oracle: mirror databases do not work
-----------------------------------+------------------------------------

Reporter: shai | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.4
Severity: Normal | Resolution:

Keywords: oracle | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by shaib):

* status: closed => new
* resolution: fixed =>


Comment:

Oops. No it wasn't.

--
Ticket URL: <https://code.djangoproject.com/ticket/19542#comment:4>

Django

unread,
Jun 4, 2015, 11:39:26 AM6/4/15
to django-...@googlegroups.com
#19542: Testing with Oracle: mirror databases do not work
-----------------------------------+------------------------------------
Reporter: shai | Owner: shaib
Type: Bug | Status: assigned
Component: Testing framework | Version: master

Severity: Normal | Resolution:
Keywords: oracle | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by shaib):

* status: new => assigned
* owner: nobody => shaib
* has_patch: 0 => 1
* version: 1.4 => master


--
Ticket URL: <https://code.djangoproject.com/ticket/19542#comment:5>

Django

unread,
Jun 4, 2015, 12:19:32 PM6/4/15
to django-...@googlegroups.com
#19542: Testing with Oracle: mirror databases do not work
-----------------------------------+------------------------------------
Reporter: shai | Owner: shaib
Type: Bug | Status: assigned
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: oracle | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by shaib):

* Attachment "test_mirroring.tgz" added.

A simple project which can be used to test that mirroring works in
testing. You will need to change credentials, of course.

Django

unread,
Jun 5, 2015, 5:29:55 AM6/5/15
to django-...@googlegroups.com
#19542: Testing with Oracle: mirror databases do not work
-----------------------------------+------------------------------------
Reporter: shai | Owner: shaib
Type: Bug | Status: closed

Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed

Keywords: oracle | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by Shai Berger <shai@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"35291df7f786f8c9b8177e4baa286e6f12597407" 35291df7]:
{{{
#!CommitTicketReference repository=""
revision="35291df7f786f8c9b8177e4baa286e6f12597407"
Fixed #19542: Made mirroring databases for tests work with Oracle

No tests are provided because there is no sane way to test database
settings within the Django test suite.

Thanks Aymeric Augustin for review.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/19542#comment:6>

Reply all
Reply to author
Forward
0 new messages