[Django] #35921: migration_test_data_persistence fails when running with parallelism > 1

7 views
Skip to first unread message

Django

unread,
Nov 19, 2024, 8:33:10 PM11/19/24
to django-...@googlegroups.com
#35921: migration_test_data_persistence fails when running with parallelism > 1
-------------------------------------+-------------------------------------
Reporter: Raphael Gaschignard | Type: Bug
Status: new | Component: Testing
| framework
Version: dev | 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
-------------------------------------+-------------------------------------
Steps to reproduce:

- Add the following file to `tests`, as `test_postgres.py`

```
import os

from test_sqlite import * # NOQA

DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"USER": "user",
"NAME": "django",
"PASSWORD": "postgres",
"HOST": "localhost",
"PORT": 5432,
"OPTIONS": {
"server_side_binding": os.getenv("SERVER_SIDE_BINDING") ==
"1",
},
},
"other": {
"ENGINE": "django.db.backends.postgresql",
"USER": "user",
"NAME": "django2",
"PASSWORD": "postgres",
"HOST": "localhost",
"PORT": 5432,
},
}
```

- In `tests`, run the following:

```
python runtests.py --settings=test_postgres -k
migration_test_data_persistence --parallel=2
```

An error should occur of the variety:

```
psycopg.errors.FeatureNotSupported: cannot truncate a table referenced in
a foreign key constraint
DETAIL: Table "model_package_advertisement_publications" references
"model_package_publication".
HINT: Truncate table "model_package_advertisement_publications" at the
same time, or use TRUNCATE ... CASCADE.
```

Running with `--parallel=1` does not trigger this issue. I imagine that
something is happening regarding the test sharding code, given that this
test calls out to a command that might not be persisting the sharding
logic.
--
Ticket URL: <https://code.djangoproject.com/ticket/35921>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 19, 2024, 8:34:29 PM11/19/24
to django-...@googlegroups.com
#35921: migration_test_data_persistence fails when running with parallelism > 1
-------------------------------------+-------------------------------------
Reporter: Raphael Gaschignard | Owner: (none)
Type: Bug | Status: new
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Raphael Gaschignard:

Old description:
New description:
An error occurs (for me at least) of the variety:

{{{
psycopg.errors.FeatureNotSupported: cannot truncate a table referenced in
a foreign key constraint
DETAIL: Table "model_package_advertisement_publications" references
"model_package_publication".
HINT: Truncate table "model_package_advertisement_publications" at the
same time, or use TRUNCATE ... CASCADE.
}}}

Running with `--parallel=1` does not trigger this issue. I imagine that
something is happening regarding the test sharding code, given that this
test calls out to a command that might not be persisting the sharding
logic.

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

Django

unread,
Nov 19, 2024, 8:46:45 PM11/19/24
to django-...@googlegroups.com
This issue was introduced with the fix for [35660] (in commit
060a22ee2dde7aa29a5a29120087c4864887325)

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

Django

unread,
Nov 19, 2024, 8:47:54 PM11/19/24
to django-...@googlegroups.com
This issue was introduced with the fix for #35660 (in commit
060a22ee2dde7aa29a5a29120087c4864887325)

--
--
Ticket URL: <https://code.djangoproject.com/ticket/35921#comment:3>
Reply all
Reply to author
Forward
0 new messages