Page MenuHomePhabricator

SpecialCentralAuthTest fails when run in a suite with PopulateCentralCheckUserIndexTablesTest
Closed, ResolvedPublic

Description

Problem
CentralAuth's SpecialCentralAuthTest class fails if run in a test suite with CheckUser's PopulateCentralCheckUserIndexTablesTest before it. 1 test fails with Failed asserting that '<div...>' contains "(centralauth-admin-info-expired"..

Steps to reproduce
In a Mediawiki checkout with CheckUser, AntiSpoof and CentralAuth enabled

  1. Copy phpunit.dist.xml to phpunit.xml
  2. Add a test suite with the following tests:
<testsuite name="failing_group">
  <file>extensions/CheckUser/tests/phpunit/integration/maintenance/PopulateCentralCheckUserIndexTablesTest.php</file>
  <file>extensions/CentralAuth/tests/phpunit/integration/Special/SpecialCentralAuthTest.php</file>
</testsuite>
  1. Run the named test suite:
mw docker mediawiki exec -- MW_DB=wikidatawikidev composer run phpunit:entrypoint -- --testsuite failing_group

Observed behaviour
The test run fails:

> phpunit '--testsuite' 'failing_group'
Using PHP 8.1.18
Running with MediaWiki settings because there might be integration tests
PHPUnit 9.6.19 by Sebastian Bergmann and contributors.

............F..............                                       27 / 27 (100%)

Time: 00:06.516, Memory: 89.00 MB

There was 1 failure:

1) MediaWiki\Extension\CentralAuth\Tests\Phpunit\Integration\Special\SpecialCentralAuthTest::testViewForExistingGlobalTemporaryAccount
Failed asserting that '<div class='mw-htmlform-ooui-wrapper oo-ui-layout oo-ui-panelLayout oo-ui-panelLayout-padded oo-ui-panelLayout-framed'><form action='/wiki/Special:CentralAuth' method='get' enctype='application/x-www-form-urlencoded' class='mw-htmlform mw-htmlform-ooui oo-ui-layout oo-ui-formLayout'><fieldset class='oo-ui-layout oo-ui-labelElement oo-ui-fieldsetLayout'><legend class='oo-ui-fieldsetLayout-header'><span class='oo-ui-iconElement-icon oo-ui-iconElement-noIcon'></span><span class='oo-ui-labelElement-label'>(centralauth-admin-view)</span></legend><div class='oo-ui-fieldsetLayout-group'><div class='oo-ui-widget oo-ui-widget-enabled'><div data-mw-modules='ext.widgets.GlobalUserInputWidget' id='ooui-php-20' class='mw-htmlform-field-HTMLGlobalUserTextField mw-htmlform-autoinfuse oo-ui-layout oo-ui-labelElement oo-ui-fieldLayout oo-ui-fieldLayout-align-top' data-ooui='{"_":"mw.htmlform.FieldLayout","fieldWidget":{"tag":"target"},"align":"top","helpInline":true,"$overlay":true,"label":{"html":"(centralauth-admin-username)"},"classes":["mw-htmlform-field-HTMLGlobalUserTextField","mw-htmlform-autoinfuse"]}'><div class='oo-ui-fieldLayout-body'><span class='oo-ui-fieldLayout-header'><label for='ooui-php-19' class='oo-ui-labelElement-label'>(centralauth-admin-username)</label></span><div class='oo-ui-fieldLayout-field'><div id='target' class='oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-indicatorElement oo-ui-textInputWidget oo-ui-textInputWidget-type-text oo-ui-textInputWidget-php mw-widget-userInputWidget' data-ooui='{"_":"mw.widgets.GlobalUserInputWidget","$overlay":true,"name":"target","value":"~2024-1","inputId":"ooui-php-19","indicator":"required","required":true}'><input type='text' tabindex='0' name='target' value='~2024-1' required='' id='ooui-php-19' class='oo-ui-inputWidget-input' /><span class='oo-ui-iconElement-icon oo-ui-iconElement-noIcon'></span><span class='oo-ui-indicatorElement-indicator oo-ui-indicator-required'></span></div></div></div></div><div class="mw-htmlform-submit-buttons">\n
<span id='centralauth-submit-find' class='mw-htmlform-submit oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-buttonElement oo-ui-buttonElement-framed oo-ui-labelElement oo-ui-flaggedElement-primary oo-ui-flaggedElement-progressive oo-ui-buttonInputWidget' data-ooui='{"_":"OO.ui.ButtonInputWidget","type":"submit","value":"(centralauth-admin-lookup-ro)","label":"(centralauth-admin-lookup-ro)","flags":["primary","progressive"],"classes":["mw-htmlform-submit"]}'><button type='submit' tabindex='0' value='(centralauth-admin-lookup-ro)' class='oo-ui-inputWidget-input oo-ui-buttonElement-button'><span class='oo-ui-iconElement-icon oo-ui-iconElement-noIcon oo-ui-image-invert'></span><span class='oo-ui-labelElement-label'>(centralauth-admin-lookup-ro)</span><span class='oo-ui-indicatorElement-indicator oo-ui-indicatorElement-noIndicator oo-ui-image-invert'></span></button></span></div>\n
</div></div></fieldset></form></div><fieldset id="mw-centralauth-info">\n
<legend>(centralauth-admin-info-header)</legend>\n
<ul><li id="mw-centralauth-admin-info-username"><strong>(centralauth-admin-info-username)</strong> ~2024-1</li><li id="mw-centralauth-admin-info-registered"><strong>(centralauth-admin-info-registered)</strong> 08:33, 17 (september) 2024 ((centralauth-seconds-ago: −11,676,487))</li><li id="mw-centralauth-admin-info-editcount"><strong>(centralauth-admin-info-editcount)</strong> 0</li><li id="mw-centralauth-admin-info-attached"><strong>(centralauth-admin-info-attached)</strong> 1</li></ul>\n
</fieldset>\n
<fieldset>\n
<legend>(centralauth-admin-list-legend-ro)</legend>\n
<form method="post" action="/index.php?title=Special:CentralAuth/~2024-1&amp;action=submit" id="mw-centralauth-merged"><input type="hidden" value="unmerge" name="wpMethod"><input type="hidden" value="3953cc695db8a9813d7b5bc7ac04a07766371381+\" name="wpEditToken"><table class="wikitable sortable mw-centralauth-wikislist">\n
<thead><tr><th>(centralauth-admin-list-localwiki)</th><th>(centralauth-admin-list-attached-on)</th><th>(centralauth-admin-list-method)</th><th>(centralauth-admin-list-blocked)</th><th>(centralauth-admin-list-editcount)</th><th>(centralauth-admin-list-groups)</th></tr></thead><tbody><tr><td><a href="https://en.wikipedia.org/wiki/User:~2024-1" title="(centralauth-foreign-link: ~2024-1, en.wikipedia.org)">en.wikipedia.org</a></td><td data-sort-value="20240405060708">06:07, 5 (april) 2024</td><td style="text-align: center;"><img src="/extensions/CentralAuth/images/icons/merged-primary.png" alt="(centralauth-merge-method-primary)" title="(centralauth-merge-method-primary)"><span class="merge-method-help" title="(centralauth-merge-method-primary)" data-centralauth-mergemethod="primary">(centralauth-merge-method-questionmark)</span></td><td><a href="https://en.wikipedia.org/wiki/Special:Log/block?page=User:%7E2024-1" title="(centralauth-admin-blocklog)">(centralauth-admin-notblocked)</a></td><td style="text-align: right;"><a href="https://en.wikipedia.org/wiki/Special:Contributions/~2024-1" title="(centralauth-foreign-contributions: 0, en.wikipedia.org)">0</a></td><td></td></tr></tbody></table></form></fieldset>' contains "(centralauth-admin-info-expired".

/var/www/html/w/extensions/CentralAuth/tests/phpunit/integration/Special/SpecialCentralAuthTest.php:380

Expected Behaviour
The tests should pass

Event Timeline

@Dreamy_Jazz This looks like an unexpected interaction between the tests for T371789 and T122016. Do you know what might be happening here?

Change #1073417 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/extensions/CheckUser@master] Add scope to temporary users created by populate tables test

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

I pushed a patch which seems to fix the issue, but I couldn't tell you exactly why. If anyone has a better understanding or alternative fix, that would be most welcome!

Change #1073417 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Add scope to temporary users created by populate tables test

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

Change #1073823 had a related patch set uploaded (by Hashar; author: Arthur taylor):

[mediawiki/extensions/CheckUser@wmf/1.43.0-wmf.23] Add scope to temporary users created by populate tables test

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

@ArthurTaylor thank you for having filed that task with all the details. That fixed the parallel build for Wikibase ;)

Change #1073823 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@wmf/1.43.0-wmf.23] Add scope to temporary users created by populate tables test

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

Change #1080261 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/extensions/CheckUser@master] Isolate temp account usage in testcase

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

Change #1080261 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Isolate temp account usage in testcase

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