After applying I326bb4a189bf881299b9fb678033a927b916efac (a crude but working way to work around bug 37702 and have database constraints on the database during unit testing), BlockTest fails twice:
- BlockTest::testBlockedUserCanNotCreateAccount
DBQueryError: A database error has occurred. Did you forget to run maintenance/update.php afte
r upgrading? See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script
Query: COMMIT
Function: DatabaseBase::commit
Error: 23503 ERROR: insert or update on table "unittest_ipblocks" violates foreign key constr
aint "ut_ipblocks_ipb_user_fkey"
DETAIL: Key (ipb_user)=(14146) is not present in table "unittest_mwuser".
/usr/home/saper/test/mytest/includes/db/Database.php:1111
/usr/home/saper/test/mytest/includes/db/DatabasePostgres.php:511
/usr/home/saper/test/mytest/includes/db/Database.php:1077
/usr/home/saper/test/mytest/includes/db/Database.php:3477
/usr/home/saper/test/mytest/includes/db/Database.php:3462
/usr/home/saper/test/mytest/includes/db/DatabasePostgres.php:241
/usr/home/saper/test/mytest/includes/db/DatabasePostgres.php:884
/usr/home/saper/test/mytest/includes/Block.php:475
/usr/home/saper/test/mytest/tests/phpunit/includes/BlockTest.php:177
/usr/home/saper/test/mytest/tests/phpunit/MediaWikiTestCase.php:123
/usr/home/saper/test/mytest/tests/phpunit/MediaWikiPHPUnitCommand.php:80
/usr/home/saper/test/mytest/tests/phpunit/MediaWikiPHPUnitCommand.php:64
/usr/home/saper/test/mytest/tests/phpunit/phpunit.php:115
- BlockTest::testCrappyCrossWikiBlocks
DBQueryError: A database error has occurred. Did you forget to run maintenance/update.php after upgrading? See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script
Query: COMMIT
Function: DatabaseBase::commit
Error: 23503 ERROR: insert or update on table "unittest_ipblocks" violates foreign key constraint "ut_ipblocks_ipb_user_fkey"
DETAIL: Key (ipb_user)=(14146) is not present in table "unittest_mwuser".
/usr/home/saper/test/mytest/includes/db/Database.php:1111
/usr/home/saper/test/mytest/includes/db/DatabasePostgres.php:511
/usr/home/saper/test/mytest/includes/db/Database.php:1077
/usr/home/saper/test/mytest/includes/db/Database.php:3477
/usr/home/saper/test/mytest/includes/db/Database.php:3462
/usr/home/saper/test/mytest/includes/db/DatabasePostgres.php:241
/usr/home/saper/test/mytest/includes/db/DatabasePostgres.php:884
/usr/home/saper/test/mytest/includes/Block.php:475
/usr/home/saper/test/mytest/tests/phpunit/includes/BlockTest.php:229
/usr/home/saper/test/mytest/tests/phpunit/MediaWikiTestCase./usr/home/saper/test/mytest/tests/phpunit/MediaWikiPHPUnitCommand.php:80
/usr/home/saper/test/mytest/tests/phpunit/MediaWikiPHPUnitCommand.php:64
/usr/home/saper/test/mytest/tests/phpunit/phpunit.php:115
php:123
Looks like the user ID 14146 is not fully in the database when the transaction is committed (we are using DEFERRED contraints so they are checked at commit, not immediately).
I have tried some simple ways to work around this and managed only fix
BlockTest::testCrappyCrossWikiBlocks by reordering calls.
Version: 1.23.0
Severity: normal