[Django] #32872: Parallel Unit tests fail to clone DBs with TimescaleDB

34 views
Skip to first unread message

Django

unread,
Jun 21, 2021, 4:59:15 PM6/21/21
to django-...@googlegroups.com
#32872: Parallel Unit tests fail to clone DBs with TimescaleDB
-------------------------------------+-------------------------------------
Reporter: kfortner | Owner: nobody
Type: New | Status: new
feature |
Component: Database | Version: 3.2
layer (models, ORM) |
Severity: Normal | Keywords: Timescale
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
If you use a TimescaleDB and run your unit tests in parallel Django will
fail to clone the first test database to the additional databases.

Cloning test database for alias 'foo' ('foo_testDB')...Got an error
creating the test database: source database "foo_testDB" is being accessed
by other users
DETAIL: There is 1 other session using the database.

#### DB Section
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'HOST': 'timescale',
'USER': "user",
'NAME': 'fooDB',
'PASSWORD': "pwd",
'PORT': '5432',
'TEST': {
'NAME': foo_testDB
}
}


#### Test call
python manage.py test --parallel 4

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

Django

unread,
Jun 21, 2021, 7:59:28 PM6/21/21
to django-...@googlegroups.com
#32872: Parallel Unit tests fail to clone DBs with TimescaleDB
-------------------------------------+-------------------------------------
Reporter: Kenneth Fortner | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution: needsinfo
Keywords: Timescale | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

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


Old description:

> If you use a TimescaleDB and run your unit tests in parallel Django will
> fail to clone the first test database to the additional databases.
>
> Cloning test database for alias 'foo' ('foo_testDB')...Got an error
> creating the test database: source database "foo_testDB" is being
> accessed by other users
> DETAIL: There is 1 other session using the database.
>
> #### DB Section
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.postgresql_psycopg2',
> 'HOST': 'timescale',
> 'USER': "user",
> 'NAME': 'fooDB',
> 'PASSWORD': "pwd",
> 'PORT': '5432',
> 'TEST': {
> 'NAME': foo_testDB
> }
> }
>

> #### Test call
> python manage.py test --parallel 4

New description:

If you use a TimescaleDB and run your unit tests in parallel Django will
fail to clone the first test database to the additional databases.
{{{
Cloning test database for alias 'foo' ('foo_testDB')...Got an error
creating the test database: source database "foo_testDB" is being accessed
by other users
DETAIL: There is 1 other session using the database.

#### DB Section
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'HOST': 'timescale',
'USER': "user",
'NAME': 'fooDB',
'PASSWORD': "pwd",
'PORT': '5432',
'TEST': {
'NAME': foo_testDB
}
}


#### Test call
python manage.py test --parallel 4
}}}

--

Comment:

Django doesn't provide any support or testing for TimescaleDB, so it's not
clear that Django is at fault. Feel free to reopen if you can at least
provide some analysis of the situation. I imagine a custom database
backend might be required which should be done as a third-party package
rather than in Django itself.

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

Reply all
Reply to author
Forward
0 new messages