Page MenuHomePhabricator

MediaWikiSiteTest::testRemove gets a duplicate key error
Closed, ResolvedPublic

Description

  1. MediaWikiSiteTest::testRemove with data set #0 (array('foo'), true)

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: INSERT INTO unittest_sites (site_id,site_global_key,site_type,site_group,site_source,site_language,site_protocol,site_domain,site_data,site_forward,site_config) VALUES (NULL,'foo','unknown','none','local','en','','.','a:0:{}','','a:0:{}')
Function: ORMRow::insert
Error: 1062 Duplicate entry 'foo' for key 'sites_global_key' (localhost)

\includes\db\Database.php:996
\includes\db\Database.php:962
\includes\db\Database.php:1720
\includes\db\ORMRow.php:397
\includes\db\ORMRow.php:338
\includes\site\SiteObject.php:465
\tests\phpunit\includes\db\ORMRowTest.php:167
\tests\phpunit\MediaWikiTestCase.php:87
\tests\phpunit\MediaWikiPHPUnitCommand.php:45
\tests\phpunit\phpunit.php:107

Looks like the ORMRow is not populated right and the id for the deletion is null.


Version: 1.21.x
Severity: normal

Details

Reference
bz42226

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 1:13 AM
bzimport set Reference to bz42226.

Seeing
DELETE FROM unittest_sites WHERE site_id IS NULL

in the log, looks like the object is not populated before calling the remove method, because I am not seeing something like

SELECT ... FROM unittest_sites WHERE ...

But why this works on jenkins?

Merged in! Thanks for the report and patch.