#36677 closed Bug (fixed)
Parallel test runner runs system checks with database aliases before those aliases are set up
| Reported by: | Jacob Walls | Owned by: | Jacob Walls |
|---|---|---|---|
| Component: | Testing framework | Version: | 6.0 |
| Severity: | Release blocker | Keywords: | |
| Cc: | Adam Zapletal | Triage Stage: | Ready for checkin |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
#36083 made the parallel test runner run system checks in workers. Well and good, but the call is done before database aliases are set up.
This should explain the recent failures with the geodjango label on Github Actions, also reproducible locally, with errors like:
django.db.utils.OperationalError: connection failed: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: database "django-postgis-other" does not exist
I'm showing this is fixed with:
-
django/test/runner.py
diff --git a/django/test/runner.py b/django/test/runner.py index 25089a6db1..73665a63d2 100644
a b def _init_worker( 463 463 process_setup(*process_setup_args) 464 464 django.setup() 465 465 setup_test_environment(debug=debug_mode) 466 call_command(467 "check", stdout=io.StringIO(), stderr=io.StringIO(), databases=used_aliases468 )469 466 470 467 db_aliases = used_aliases if used_aliases is not None else connections 471 468 for alias in db_aliases: … … def _init_worker( 477 474 connection._test_serialized_contents = value 478 475 connection.creation.setup_worker_connection(_worker_id) 479 476 477 if is_spawn_or_forkserver: 478 call_command( 479 "check", stdout=io.StringIO(), stderr=io.StringIO(), databases=used_aliases 480 ) 480 481 481 482 def _run_subsuite(args): 482 483 """
Regression in 606fc352799e372928fa2c978ab99f0fb6d6017c.
Interestingly, this specific failure did not manifest until e8190b370e508648b0f0ee9b86876f97d3997e14.
Change History (5)
comment:1 by , 3 weeks ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:3 by , 3 weeks ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
Note:
See TracTickets
for help on using tickets.
Thank you Jacob for investigating and fixing this!