[Django] #27435: Raise an error when using --keepdb without an explicit TEST.PASSWORD on Oracle

27 views
Skip to first unread message

Django

unread,
Nov 5, 2016, 3:43:01 AM11/5/16
to django-...@googlegroups.com
#27435: Raise an error when using --keepdb without an explicit TEST.PASSWORD on
Oracle
---------------------------------------------+------------------------
Reporter: Simon Charette | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.10
Severity: Release blocker | Keywords: oracle
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------------+------------------------
This can be [https://groups.google.com/d/msg/django-
users/n9IFuRBN9hY/Y8TWLyWUAQAJ a source of confusion] as the kept database
is not usable anymore on the second run since we randomly generate a
password when `TEST.PASSWORD` is not provided.

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

Django

unread,
Nov 5, 2016, 5:07:01 AM11/5/16
to django-...@googlegroups.com
#27435: Raise an error when using --keepdb without an explicit TEST.PASSWORD on
Oracle
-----------------------------------+------------------------------------

Reporter: Simon Charette | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.10
Severity: Release blocker | 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 felixxm):

* stage: Unreviewed => Accepted


Comment:

I think that the best solution will be to set up password randomly every
time where it's not set and we use `--keepdb` flag:

{{{#!python
--- a/django/db/backends/oracle/creation.py
+++ b/django/db/backends/oracle/creation.py
@@ -225,7 +225,7 @@ class DatabaseCreation(BaseDatabaseCreation):
acceptable_ora_err = 'ORA-01920' if keepdb else None
success = self._execute_allow_fail_statements(cursor, statements,
parameters, verbosity, acceptable_ora_err)
# If the password was randomly generated, change the user
accordingly.
- if not success and self._test_settings_get('PASSWORD') is None:
+ if (not success or keepdb) and
self._test_settings_get('PASSWORD') is None:
set_password = "ALTER USER %(user)s IDENTIFIED BY
%(password)s"
self._execute_statements(cursor, [set_password], parameters,
verbosity)
# Most test-suites can be run without the create-view privilege.
But some need it.
}}}

I can prepare PR.

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

Django

unread,
Nov 5, 2016, 5:07:44 AM11/5/16
to django-...@googlegroups.com
#27435: Raise an error when using --keepdb without an explicit TEST.PASSWORD on
Oracle
-----------------------------------+--------------------------------------

Reporter: Simon Charette | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.10
Severity: Release blocker | Resolution:

Keywords: oracle | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by felixxm):

* stage: Accepted => Unreviewed


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

Django

unread,
Nov 5, 2016, 5:20:32 AM11/5/16
to django-...@googlegroups.com
#27435: Raise an error when using --keepdb without an explicit TEST.PASSWORD on
Oracle
-----------------------------------+------------------------------------

Reporter: Simon Charette | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.10
Severity: Release blocker | 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 Shai Berger):

* stage: Unreviewed => Accepted


Comment:

Not sure I'd call it a release blocker, but since we're going to fix this
area anyway for the next release...

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

Django

unread,
Nov 5, 2016, 5:44:38 AM11/5/16
to django-...@googlegroups.com
#27435: Raise an error when using --keepdb without an explicit TEST.PASSWORD on
Oracle
-----------------------------------+------------------------------------

Reporter: Simon Charette | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.10
Severity: Release blocker | 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
-----------------------------------+------------------------------------

Comment (by Simon Charette):

@felixxm

> I think that the best solution will be to set up password randomly every
time where it's not set and we use --keepdb flag:

I'm not too familar with Oracle's authentication management but how are
you going to re-connect to the kept database on the second run if you
generate a random on the first one?

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

Django

unread,
Nov 5, 2016, 5:48:59 AM11/5/16
to django-...@googlegroups.com
#27435: Raise an error when using --keepdb without an explicit TEST.PASSWORD on
Oracle
-----------------------------------+------------------------------------

Reporter: Simon Charette | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.10
Severity: Release blocker | 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
-----------------------------------+------------------------------------

Comment (by Shai Berger):

Replying to [comment:4 Simon Charette]:


> @felixxm
>
> > I think that the best solution will be to set up password randomly
every time where it's not set and we use --keepdb flag:
>
> I'm not too familar with Oracle's authentication management but how are
you going to re-connect to the kept database on the second run if you
generate a random on the first one?
>

I'm glad to see it wasn't just me who missed @felixx's intention...

He suggested that we use our administrative user to change the test user's
password to a new random password on each run. I think this is a better
solution.

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

Django

unread,
Nov 5, 2016, 5:50:21 AM11/5/16
to django-...@googlegroups.com
#27435: Raise an error when using --keepdb without an explicit TEST.PASSWORD on
Oracle
-----------------------------------+------------------------------------

Reporter: Simon Charette | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.10
Severity: Release blocker | 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
-----------------------------------+------------------------------------

Comment (by Simon Charette):

> He suggested that we use our administrative user to change the test


user's password to a new random password on each run. I think this is a
better solution.

Thanks for the clarification Shai. It sounds like a better solution to me
too.

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

Django

unread,
Nov 5, 2016, 6:03:28 AM11/5/16
to django-...@googlegroups.com
#27435: Raise an error when using --keepdb without an explicit TEST.PASSWORD on
Oracle
-----------------------------------+------------------------------------
Reporter: Simon Charette | Owner: felixxm
Type: Bug | Status: assigned

Component: Testing framework | Version: 1.10
Severity: Release blocker | 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 felixxm):

* status: new => assigned
* owner: nobody => felixxm


Comment:

Sorry for unclear explanation.

--
Ticket URL: <https://code.djangoproject.com/ticket/27435#comment:7>

Django

unread,
Nov 5, 2016, 7:32:36 AM11/5/16
to django-...@googlegroups.com
#27435: Raise an error when using --keepdb without an explicit TEST.PASSWORD on
Oracle
-----------------------------------+------------------------------------
Reporter: Simon Charette | Owner: felixxm
Type: Bug | Status: assigned
Component: Testing framework | Version: 1.10
Severity: Release blocker | 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
-----------------------------------+------------------------------------

Comment (by felixxm):

Now I see that we already change the test user's password on each run (see
[https://github.com/django/django/blob/master/django/db/backends/oracle/creation.py#L228
1]). `ORA-01920` means that user already exists.

I think that the problem may be in the `ALTER USER` permission missing.
It's hard to say without error details.

--
Ticket URL: <https://code.djangoproject.com/ticket/27435#comment:8>

Django

unread,
Nov 5, 2016, 8:57:14 AM11/5/16
to django-...@googlegroups.com
#27435: Raise an error when using --keepdb without an explicit TEST.PASSWORD on
Oracle
-----------------------------------+------------------------------------
Reporter: Simon Charette | Owner: felixxm
Type: Bug | Status: assigned
Component: Testing framework | Version: 1.10
Severity: Release blocker | 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 Carsten Fuchs):

* cc: carsten.fuchs@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/27435#comment:9>

Django

unread,
Nov 5, 2016, 9:05:31 AM11/5/16
to django-...@googlegroups.com
#27435: Raise an error when using --keepdb without an explicit TEST.PASSWORD on
Oracle
-----------------------------------+------------------------------------
Reporter: Simon Charette | Owner: felixxm
Type: Bug | Status: assigned
Component: Testing framework | Version: 1.10
Severity: Release blocker | 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
-----------------------------------+------------------------------------

Comment (by Simon Charette):

> I think that the problem may be in the ALTER USER permission missing.


It's hard to say without error details.

This ticket might be invalid as I didn't reproduce the error myself. Are
we sure that `--keepdb` actually works when no test password is defined?
Or is the database simply dropped by the admin user if we can't connect to
it on the second run?

--
Ticket URL: <https://code.djangoproject.com/ticket/27435#comment:10>

Django

unread,
Nov 5, 2016, 10:23:29 AM11/5/16
to django-...@googlegroups.com
#27435: Raise an error when using --keepdb without an explicit TEST.PASSWORD on
Oracle
-----------------------------------+------------------------------------
Reporter: Simon Charette | Owner: felixxm
Type: Bug | Status: assigned
Component: Testing framework | Version: 1.10
Severity: Release blocker | 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
-----------------------------------+------------------------------------

Comment (by felixxm):

Replying to [comment:10 Simon Charette]:


> > I think that the problem may be in the ALTER USER permission missing.
It's hard to say without error details.
>
> This ticket might be invalid as I didn't reproduce the error myself. Are
we sure that `--keepdb` actually works when no test password is defined?
Or is the database simply dropped by the admin user if we can't connect to
it on the second run?

If administrative user has `DBA` permission (which includes `ALTER USER`)
then `test` works properly with `--keepdb` option. I checked this few
times. IMO this ticket should be close.

--
Ticket URL: <https://code.djangoproject.com/ticket/27435#comment:11>

Django

unread,
Nov 5, 2016, 11:17:44 AM11/5/16
to django-...@googlegroups.com
#27435: Raise an error when using --keepdb without an explicit TEST.PASSWORD on
Oracle
-----------------------------------+-------------------------------------

Reporter: Simon Charette | Owner: felixxm
Type: Bug | Status: closed

Component: Testing framework | Version: 1.10
Severity: Release blocker | Resolution: needsinfo

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 Shai Berger):

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


Comment:

Per the last two messages, closing until further details of the actual
problem encountered can be provided.

Thanks, @felixxm.

--
Ticket URL: <https://code.djangoproject.com/ticket/27435#comment:12>

Reply all
Reply to author
Forward
0 new messages