https://bugzilla.wikimedia.org/show_bug.cgi?id=58191

       Web browser: ---
            Bug ID: 58191
           Summary: BlockTest should not fail under database constraints
           Product: MediaWiki
           Version: 1.23-git
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: User blocking
          Assignee: wikibugs-l@lists.wikimedia.org
          Reporter: marcin.cies...@gmail.com
                CC: aschulz4...@gmail.com, cste...@wikimedia.org,
                    has...@free.fr
            Blocks: 37702
    Classification: Unclassified
   Mobile Platform: ---

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to