Page MenuHomePhabricator

Wikibase CI broken since $tablesUsed replaced with automatic query tracking
Closed, ResolvedPublic

Description

There are two errors in Wikibase CI builds (example build):

1) WikibaseQuality\ConstraintReport\Tests\Specials\SpecialConstraintReportTest::testExecute with data set "valid input - existing item" ('$id', array(), 'qqx', array(Hamcrest\Core\CombinableMatcher Object (...), Hamcrest\Core\CombinableMatcher Object (...), Hamcrest\Core\CombinableMatcher Object (...), Hamcrest\Core\CombinableMatcher Object (...), Hamcrest\Core\CombinableMatcher Object (...), WMDE\HamcrestHtml\ComplexTagMatcher Object (...), Hamcrest\Core\CombinableMatcher Object (...), Hamcrest\Core\CombinableMatcher Object (...), Hamcrest\Core\CombinableMatcher Object (...), Hamcrest\Core\CombinableMatcher Object (...), Hamcrest\Core\CombinableMatcher Object (...), Hamcrest\Core\CombinableMatcher Object (...)))
Hamcrest\AssertionError: Failed to assert output: result for
Expected: is valid html piece having child (with tag name "h3" and having text contents a string containing "(wbqc-constraintreport-result-headline) ")
     but: valid html piece having no children (with tag name "h3" and having text contents a string containing "(wbqc-constraintreport-result-headline) ")
Actual html:
<div class="wbqc-explanation"><p>(wbqc-constraintreport-explanation-part-one)</p><p>(wbqc-constraintreport-explanation-part-two)</p></div><div class='mw-htmlform-ooui-wrapper oo-ui-layout oo-ui-panelLayout'><form action='/index.php/Special:ConstraintReport' method='post' enctype='application/x-www-form-urlencoded' class='mw-htmlform mw-htmlform-ooui oo-ui-layout oo-ui-formLayout'><input type="hidden" value="Special:ConstraintReport" name="title">
<div class='oo-ui-layout oo-ui-panelLayout oo-ui-panelLayout-padded oo-ui-panelLayout-framed'><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'>(wbqc-constraintreport-form-section)</span></legend><div class='oo-ui-fieldsetLayout-group'><div class='oo-ui-widget oo-ui-widget-enabled'><div id="mw-htmlform-section"><div id='ooui-php-1234' class='mw-htmlform-field-HTMLTextField wbqc-constraintreport-form-entity-id oo-ui-layout oo-ui-labelElement oo-ui-fieldLayout oo-ui-fieldLayout-align-top' data-ooui='{"_":"mw.htmlform.FieldLayout","fieldWidget":{"tag":"mw-input-entityid"},"align":"top","helpInline":true,"$overlay":true,"label":{"html":"(wbqc-constraintreport-form-entityid-label)"},"classes":["mw-htmlform-field-HTMLTextField","wbqc-constraintreport-form-entity-id"]}'><div class='oo-ui-fieldLayout-body'><span class='oo-ui-fieldLayout-header'><label for='ooui-php-1233' class='oo-ui-labelElement-label'>(wbqc-constraintreport-form-entityid-label)</label></span><div class='oo-ui-fieldLayout-field'><div id='mw-input-entityid' class='wbqc-constraintreport-form-entity-id oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-textInputWidget oo-ui-textInputWidget-type-text oo-ui-textInputWidget-php' data-ooui='{"_":"OO.ui.TextInputWidget","placeholder":"(wbqc-constraintreport-form-entityid-placeholder)","name":"entityid","inputId":"ooui-php-1233","required":false,"classes":["wbqc-constraintreport-form-entity-id"]}'><input type='text' tabindex='0' name='entityid' value='' placeholder='(wbqc-constraintreport-form-entityid-placeholder)' id='ooui-php-1233' class='oo-ui-inputWidget-input' /><span class='oo-ui-iconElement-icon oo-ui-iconElement-noIcon'></span><span class='oo-ui-indicatorElement-indicator oo-ui-indicatorElement-noIndicator'></span></div></div></div></div></div></div></div></fieldset></div>
<input id="wpEditToken" type="hidden" value="+\" name="wpEditToken">
<div class="mw-htmlform-submit-buttons">
<span id='ooui-php-1235' 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":"(wbqc-constraintreport-form-submit-label)","label":"(wbqc-constraintreport-form-submit-label)","flags":["primary","progressive"],"classes":["mw-htmlform-submit"]}'><button type='submit' tabindex='0' value='(wbqc-constraintreport-form-submit-label)' 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'>(wbqc-constraintreport-form-submit-label)</span><span class='oo-ui-indicatorElement-indicator oo-ui-indicatorElement-noIndicator oo-ui-image-invert'></span></button></span></div>
</form></div><p class="wbqc-constraintreport-notice wbqc-constraintreport-notice-error">(wbqc-constraintreport-not-existent-entity)</p>

/workspace/src/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/MatcherAssert.php:115
/workspace/src/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/MatcherAssert.php:63
/workspace/src/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php:28
/workspace/src/tests/phpunit/HamcrestPHPUnitIntegration.php:32
/workspace/src/extensions/WikibaseQualityConstraints/tests/phpunit/Specials/SpecialConstraintReportTest.php:159
1) PropertySuggester\GetSuggestionsTest::testExecutionWithRedirect
Failed asserting that exception message 'Could not find an entity with the ID "Q1".' contains 'The given entity ID refers to a redirect, which is not supported in this context.'.

I can reproduce both locally, and both pass again if I locally revert Replace MediaWikiIntegrationTestCase::$tablesUsed with automatic query tracking (T342301).

Event Timeline

Apparently both affected tests have this pattern:

	public function addDBData() {
		if ( !self::$hasSetup ) {
			// ...
			self::$hasSetup = true;
		}

I’ll see if I can fix this in WBQC first, since I’m more familiar with that extension; perhaps the solution will also apply to PropertySuggester, we’ll see.

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

[mediawiki/extensions/WikibaseQualityConstraints@master] Use addDBDataOnce() in special page integration test

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

Okay, for WBQC the fix really seems to be as straightforward as you might expect from looking at that code. Let’s see if PS also works like that.

(Also, we might need to force-merge one of the two changes, or temporarily disable the test, or something.)

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

[mediawiki/extensions/PropertySuggester@master] Use addDBDataOnce() in API integration test

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

Okay, moving the $hasSetup part into addDBDataOnce() also works in PS. Yay!

(Also, we might need to force-merge one of the two changes, or temporarily disable the test, or something.)

Yeah, the PropertySuggester change is still failing due to the WikibaseQualityConstraints error and vice versa. Let’s temporarily skip the WBQC test, that one has fewer test methods than the PropertySuggester class.

Change 976215 merged by Jforrester:

[mediawiki/extensions/PropertySuggester@master] Use addDBDataOnce() in API integration test

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

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

[mediawiki/extensions/WikibaseQualityConstraints@master] Temporarily skip SpecialConstraintReportTest

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

Change 976225 abandoned by Lucas Werkmeister (WMDE):

[mediawiki/extensions/WikibaseQualityConstraints@master] Temporarily skip SpecialConstraintReportTest

Reason:

Jdforrester decided to force-merge instead

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

Apparently both affected tests have this pattern: [...]

Indeed, that pattern had already caused some test failures before. I thought I had fixed all of them before putting my change up for review, but apparently some of them went unnoticed.

Well, codesearch didn’t find any other classes using the pattern with that particular variable name, for what it’s worth. (It would be nice if we could grep for “addDbData() methods where the first line is an if statement” but I don’t think codesearch supports searching across lines.)

Change 976213 merged by jenkins-bot:

[mediawiki/extensions/WikibaseQualityConstraints@master] Use addDBDataOnce() in special page integration test

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

Probably done, I’ll close it once another CI run has finished successfully.