Last modified: 2014-10-15 18:19:17 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T60191, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 58191 - BlockTest should not fail under database constraints
BlockTest should not fail under database constraints
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
User blocking (Other open bugs)
1.23.0
All All
: High normal (vote)
: 1.25.0 release
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: 37702
  Show dependency treegraph
 
Reported: 2013-12-08 22:17 UTC by Marcin Cieślak
Modified: 2014-10-15 18:19 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Marcin Cieślak 2013-12-08 22:17:16 UTC
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:


1) 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

2) 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.
Comment 1 Gerrit Notification Bot 2013-12-08 22:20:41 UTC
Change 100334 had a related patch set uploaded by saper:
Let BlockTest.php respect database constraints

https://gerrit.wikimedia.org/r/100334
Comment 2 Marcin Cieślak 2013-12-08 22:22:51 UTC
The above quick&dirty patch manages to "fix" BlockTest::testCrappyCrossWikiBlocks
but BlockTest::testBlockedUserCanNotCreateAccount still fails with:

1) BlockTest::testBlockedUserCanNotCreateAccount
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:178
/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
Comment 3 Gerrit Notification Bot 2014-10-15 18:16:50 UTC
Change 100334 merged by jenkins-bot:
Let BlockTest.php respect database constraints

https://gerrit.wikimedia.org/r/100334

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links