From e23377eb6a54923c3a55e0e76736e9568218e94b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20L=C3=BCtzner?= Date: Mon, 19 Oct 2026 13:51:50 +0200 Subject: [PATCH] Migrate test databases with app:db:migrate so the cache tables exist (#225) doctrine:migrations:migrate leaves cache_items out; without it the first cache read inside a test's transaction aborts it, so ThreadSummaryTest and the Gmail import tests failed whenever nothing had created the table first. --- bin/test-unit.sh | 10 ++++++++-- compose.test.yaml | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bin/test-unit.sh b/bin/test-unit.sh index a2cfee9d..f4e4aa22 100644 --- a/bin/test-unit.sh +++ b/bin/test-unit.sh @@ -21,7 +21,13 @@ # to invent a second DATABASE_URL. # # The cost is that a fresh database needs creating, migrating and seeding, which -# is what the rest of this does. Migrations are a no-op once they have run, so +# is what the rest of this does. Migrated with app:db:migrate, as an install is, +# not doctrine:migrations:migrate: the migrations leave the cache tables out +# (see DatabaseCacheTables) and only the app's command creates them. Without +# them the first cache read inside a test's transaction fails, Postgres aborts +# the transaction, and whichever test got there first errors with "current +# transaction is aborted" — ThreadSummaryTest or the Gmail import tests, +# depending on what ran before them. Migrations are a no-op once they have run, so # only the first invocation is slow. # # The two seeded users are not optional: PageRendersTest, ListFragmentTest and @@ -32,7 +38,7 @@ set -e export TEST_TOKEN=_unit php bin/console doctrine:database:create --if-not-exists --quiet -php bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration --quiet +php bin/console app:db:migrate --no-interaction --quiet php bin/console app:test:seed-user --quiet php bin/console app:test:seed-user --admin --email=e2e-admin@plmail.test --password=e2e-admin-password --quiet diff --git a/compose.test.yaml b/compose.test.yaml index 43913c5c..e7ccf13b 100644 --- a/compose.test.yaml +++ b/compose.test.yaml @@ -57,7 +57,7 @@ services: set -e [ -f vendor/autoload_runtime.php ] || composer install --prefer-dist --no-progress --no-interaction php bin/console doctrine:database:create --if-not-exists - php bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration + php bin/console app:db:migrate --no-interaction php bin/console importmap:install php bin/console tailwind:build \ || { sleep 5; php bin/console tailwind:build; } \