Page MenuHomePhabricator

WikibaseValueFormatterBuildersTest::testNewFormatter() fails if InstantCommons is enabled
Closed, ResolvedPublic2 Estimated Story Points

Description

As a Wikibase developer, I want to run the test suite locally without errors, to see if there’s something wrong with my changes or not.

Problem:
With $wgUseInstantCommons = true in my LocalSettings.php, this test fails:

1) Wikibase\Lib\Tests\Formatters\WikibaseValueFormatterBuildersTest::testNewFormatter with data set "html commons inline image" ('CommonsMedia', 'text/html; disposition=verbose', ValueFormatters\FormatterOptions Object (...), DataValues\StringValue Object (...), '@^<div.*>.*<a.*href="https://...iv>$@s')
HTTP request blocked: https://commons.wikimedia.org/w/api.php?titles=File%3ADOES-NOT-EXIST-dfsdf.jpg&iiprop=timestamp%7Cuser%7Ccomment%7Curl%7Csize%7Csha1%7Cmetadata%7Cmime%7Cmediatype%7Cextmetadata&prop=imageinfo&iimetadataversion=2&iiextmetadatamultilang=1&format=json&action=query&redirects=true&uselang=en by ForeignAPIRepo::httpGet. Use MockHttpTrait.

/var/www/html/wiki1/tests/phpunit/mocks/NullHttpRequestFactory.php:46
/var/www/html/wiki1/includes/filerepo/ForeignAPIRepo.php:557
/var/www/html/wiki1/includes/filerepo/ForeignAPIRepo.php:605
/var/www/html/wiki1/includes/libs/objectcache/wancache/WANObjectCache.php:1725
/var/www/html/wiki1/includes/libs/objectcache/wancache/WANObjectCache.php:1555
/var/www/html/wiki1/includes/filerepo/ForeignAPIRepo.php:617
/var/www/html/wiki1/includes/filerepo/ForeignAPIRepo.php:224
/var/www/html/wiki1/includes/filerepo/file/ForeignAPIFile.php:68
/var/www/html/wiki1/includes/filerepo/FileRepo.php:432
/var/www/html/wiki1/includes/filerepo/ForeignAPIRepo.php:137
/var/www/html/wiki1/includes/filerepo/FileRepo.php:473
/var/www/html/wiki1/includes/filerepo/RepoGroup.php:145
/var/www/html/wiki1/extensions/Wikibase/lib/includes/Formatters/CommonsInlineImageFormatter.php:105
/var/www/html/wiki1/extensions/Wikibase/lib/tests/phpunit/Formatters/WikibaseValueFormatterBuildersTest.php:249
/var/www/html/wiki1/tests/phpunit/MediaWikiIntegrationTestCase.php:530
=== Logs generated by test case
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"HashBagOStuff"}
[localisation] [debug] LocalisationCache using store LCStoreNull []
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"HashBagOStuff"}
[objectcache] [debug] fetchOrRegenerate(global:filerepo-file:wiki1-unittest_:3937355f25a3ccacedd1c95a2b4bcc55bd44c56f): miss, new value computed []
[objectcache] [debug] fetchOrRegenerate(global:filerepo-file-redirect:wiki1-unittest_:05f5d62c0b2c71339397357ff08781fd): miss, new value computed []
[wfDebug] [debug] ForeignAPIRepo: HTTP GET: https://commons.wikimedia.org/w/api.php?titles=File%3ADOES-NOT-EXIST-dfsdf.jpg&iiprop=timestamp%7Cuser%7Ccomment%7Curl%7Csize%7Csha1%7Cmetadata%7Cmime%7Cmediatype%7Cextmetadata&prop=imageinfo&iimetadataversion=2&iiextmetadatamultilang=1&format=json&action=query&redirects=true&uselang=en {"private":false}
===

Workaround:

$wgUseInstantCommons = !defined( 'MW_PHPUNIT_TEST' ); // T343133

Notes:
This has happened before, see T268890: Some Wikibase API tests fail if Instant Commons is enabled (I blatantly reused parts of the task description).

Event Timeline

Change 943577 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Disable InstantCommons in WikibaseValueFormatterBuildersTest

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

Change 943577 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Disable InstantCommons in WikibaseValueFormatterBuildersTest

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