#33677: Django test does not migrate parallel db's if --keepdb --parallel
option is
used
---------------------------------------------+------------------------
Reporter: Barney Szabolcs | Owner: nobody
Type: Uncategorized | Status: new
Component: Testing framework | Version: 2.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------------+------------------------
To run my tests, I run
{{{
./manage.py test --keepdb --parallel -v 2
}}}
I use postgres db and if I have any change in the db (eg. a field added),
the parallel db's don't get migrated.
The output when the tests fail after the migration:
{{{
Running migrations:
Applying mymodel.0007_auto_20220503_1433... OK
Using existing clone for alias 'default' ('myproject_test')...
Cache table 'rhymedict_cache' already exists.
Using existing clone for alias 'default' ('myproject_test')...
Using existing clone for alias 'default' ('myproject_test')...
Using existing clone for alias 'default' ('myproject_test')...
...
======================================================================
ERROR: test_mytest
(myproject.myapp.test.MyTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
...
psycopg2.errors.UndefinedColumn: column "field2" of relation
"myapp_mymodel" does not exist
LINE 1: ... "field1", "field2") VA...
...
django.db.utils.ProgrammingError: column "field2" of relation
"myapp_mymodel" does not exist
LINE 1: ... "field1", "field2") VA...
}}}
After I drop the myproject_test_1... myproject_test_4 db's manually and
run the command again:
{{{
Using existing test database for alias 'default' ('myproject_test')...
Operations to perform:
Synchronize unmigrated apps: analytical, compressor, cookielaw,
corsheaders, crispy_forms, debug_toolbar, dj_rest_auth, django_hosts,
genlocale, import_export, massadmin, menu, messages, rest_framework,
rosetta, sitemaps, static_sitemaps, staticfiles
Apply all migrations: myapp1, myapp2
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Running migrations:
No migrations to apply.
Cache table 'myproject_cache' already exists.
Using existing clone for alias 'default' ('myproject_test')...
Got an error creating the test database: source database "myproject_test"
is being accessed by other users
DETAIL: There is 1 other session using the database.
}}}
Without the --parallel option, the test command runs just fine.
My Django version is 2.2.12
--
Ticket URL: <https://code.djangoproject.com/ticket/33677>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/010701808a82561e-08051258-3047-4a8d-8aef-7d998e8f491d-000000%40eu-central-1.amazonses.com.