Page MenuHomePhabricator

CentralAuth tests failing if GlobalPreferences is loaded
Closed, ResolvedPublic

Description

Discovered in https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/TheWikipediaLibrary/+/543233/, with a little bit of investigation.

This is an example:

1) CentralAuthIdLookupTest::testCentralIdFromLocalUser with data set #0 ('GlobalUser', 1001, true)
=== Logs generated by test case
[wfDebug] [debug] User: loading options for user 4 from database. {"private":false}
[GlobalTitleFail] [info] RequestContext::getTitle called by Hooks::run/Hooks::callHook/GlobalPreferences\Hooks::onUserSaveOptions/GlobalPreferences\GlobalPreferencesFactory->onGlobalPrefsPage/RequestContext->getTitle with no title set. {"private":false}
[wfDebug] [debug] User: loading options for user 5 from database. {"private":false}
[GlobalTitleFail] [info] RequestContext::getTitle called by Hooks::run/Hooks::callHook/GlobalPreferences\Hooks::onUserSaveOptions/GlobalPreferences\GlobalPreferencesFactory->onGlobalPrefsPage/RequestContext->getTitle with no title set. {"private":false}
[wfDebug] [debug] User: loading options for user 6 from database. {"private":false}
[GlobalTitleFail] [info] RequestContext::getTitle called by Hooks::run/Hooks::callHook/GlobalPreferences\Hooks::onUserSaveOptions/GlobalPreferences\GlobalPreferencesFactory->onGlobalPrefsPage/RequestContext->getTitle with no title set. {"private":false}
[localisation] [debug] LocalisationCache: using store LCStoreNull []
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
===
Failed asserting that 0 is identical to 1001.

/workspace/src/extensions/CentralAuth/tests/phpunit/CentralAuthIdLookupTest.php:160
/workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:456
/workspace/src/maintenance/doMaintenance.php:99

I've investigated locally, and the culprit seems to be GlobalPreferencesHooks::onUserLoadOptions (which gets called when editing a page). The first thing the method does is:

$globalPreferences = self::getPreferencesFactory( $user );
$globalPreferences->isUserGlobalized()

and that is somehow causing the error on its own (I've stopped my investigation here).

Event Timeline

Daimona created this task.Oct 17 2019, 4:10 PM
Restricted Application added a project: Community-Tech. · View Herald TranscriptOct 17 2019, 4:10 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Krinkle added a subscriber: Krinkle.

Re-tagging ci-test-error as it seems CentralAuth and GlobalPref themselves are passing on master.

MaxSem added a subscriber: MaxSem.Nov 21 2019, 11:39 PM

Change 563503 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/CentralAuth@master] invalidateCache in CentralAuthIdLookupTest::testCentralIdFromLocalUser

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

Change 563581 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/GlobalPreferences@master] Always test with local CentralIdLookup

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

Change 563581 merged by jenkins-bot:
[mediawiki/extensions/GlobalPreferences@master] Always test with local CentralIdLookup

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

Change 563503 merged by jenkins-bot:
[mediawiki/extensions/CentralAuth@master] Reorder local user creation in CentralAuthTestUser

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

Jdforrester-WMF closed this task as Resolved.Jan 16 2020, 10:10 PM
Jdforrester-WMF assigned this task to Umherirrender.