Commit 388480d
committed
Fix unit test failures on CS10 CI image
The test_async_pull_through_add test needed transaction=True because
sync_to_async runs on a thread pool worker with a separate DB connection
that can't see the main thread's uncommitted savepoint data.
Using TransactionTestCase exposed two additional issues:
- The base Repository has CONTENT_TYPES = [], so the task failed with
"unsupported content types". Patch CONTENT_TYPES on the class so the
re-fetched repo instance in the task also sees it.
- TransactionTestCase teardown calls flush which emits post_migrate
signals, but Django's emit_post_migrate_signal doesn't pass the
`apps` kwarg. Made all four post_migrate handlers accept apps=None
with a fallback to django.apps.apps.
- After flush, the global default_domain cache is stale (old PK no
longer in DB). Clear it in _ensure_default_domain so the domain is
re-created, preventing FK violations in subsequent handlers.
Also mock redis_tasks.async_are_resources_available for runners that
use WORKER_TYPE=redis, where the dispatch path bypasses the postgres
advisory lock code entirely and tries to connect to Redis.
Assisted-By: Claude Opus 4.61 parent 6a88818 commit 388480d
3 files changed
Lines changed: 32 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
73 | 77 | | |
74 | 78 | | |
75 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
279 | 283 | | |
280 | 284 | | |
281 | 285 | | |
| |||
319 | 323 | | |
320 | 324 | | |
321 | 325 | | |
322 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
323 | 331 | | |
324 | 332 | | |
325 | 333 | | |
| |||
328 | 336 | | |
329 | 337 | | |
330 | 338 | | |
| 339 | + | |
331 | 340 | | |
332 | 341 | | |
| 342 | + | |
333 | 343 | | |
334 | 344 | | |
335 | 345 | | |
| |||
343 | 353 | | |
344 | 354 | | |
345 | 355 | | |
346 | | - | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
347 | 361 | | |
348 | 362 | | |
349 | 363 | | |
| |||
402 | 416 | | |
403 | 417 | | |
404 | 418 | | |
405 | | - | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
406 | 424 | | |
407 | 425 | | |
408 | 426 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
578 | | - | |
| 578 | + | |
579 | 579 | | |
580 | 580 | | |
581 | 581 | | |
582 | 582 | | |
583 | 583 | | |
584 | 584 | | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
585 | 589 | | |
586 | 590 | | |
| 591 | + | |
587 | 592 | | |
588 | 593 | | |
589 | 594 | | |
| |||
0 commit comments