Page MenuHomePhabricator

MobileFrontend tests that depend on ext:ParserMigration are currently failing (and also don't seem to be being run in CI)
Open, MediumPublic3 Estimated Story Points

Description

The MobileFrontend tests under MobileFrontendHooksTest::testArticleParserOptions currently seem to be failing when I test them locally (with both MobileFrontend & ParserMigration installed):

$ composer phpunit -- extensions/MobileFrontend --filter "MobileFrontendHooksTest::testArticleParserOptions"
Using PHP 8.5.2
Running with MediaWiki settings because there might be integration tests
PHPUnit 9.6.21 by Sebastian Bergmann and contributors.

EEEEEEEE                                                            8 / 8 (100%)

Time: 00:00.232, Memory: 67.31 MB

There were 8 errors:

1) MobileFrontendHooksTest::testArticleParserOptions with data set "desktop, no parsoid" (false, false, 0, false)
RuntimeException: Database backend disabled

/[...]/includes/libs/Rdbms/LoadBalancer/LoadBalancerDisabled.php:57
/[...]/includes/Page/LinkCache.php:450
/[...]/includes/Page/LinkCache.php:489
/[...]/includes/Page/PageStore.php:186
/[...]/includes/Page/PageStore.php:153
/[...]/includes/Page/PageStore.php:325
/[...]/includes/Title/Title.php:3724
/[...]/includes/Title/Title.php:1069
/[...]/includes/Title/Title.php:1088
/[...]/extensions/ParserMigration/src/Oracle.php:138
/[...]/extensions/ParserMigration/src/Oracle.php:37
/[...]/extensions/MobileFrontend/includes/MobileFrontendHooks.php:1070
/[...]/extensions/MobileFrontend/tests/phpunit/integration/MobileFrontendHooksTest.php:525
=== Logs generated by test case
[...]
===

2) MobileFrontendHooksTest::testArticleParserOptions with data set "desktop, parsoid enabled" (false, true, 0, false)
RuntimeException: Database backend disabled

/[...]/includes/libs/Rdbms/LoadBalancer/LoadBalancerDisabled.php:57
/[...]/includes/Page/LinkCache.php:450
/[...]/includes/Page/LinkCache.php:489
/[...]/includes/Page/PageStore.php:186
/[...]/includes/Page/PageStore.php:153
/[...]/includes/Page/PageStore.php:325
/[...]/includes/Title/Title.php:3724
/[...]/includes/Title/Title.php:1069
/[...]/includes/Title/Title.php:1088
/[...]/extensions/ParserMigration/src/Oracle.php:138
/[...]/extensions/ParserMigration/src/Oracle.php:37
/[...]/extensions/MobileFrontend/includes/MobileFrontendHooks.php:1070
/[...]/extensions/MobileFrontend/tests/phpunit/integration/MobileFrontendHooksTest.php:525
=== Logs generated by test case
[...]
===

3) MobileFrontendHooksTest::testArticleParserOptions with data set "mobile, no parsoid" (true, false, 0, false)
RuntimeException: Database backend disabled

/[...]/includes/libs/Rdbms/LoadBalancer/LoadBalancerDisabled.php:57
/[...]/includes/Page/LinkCache.php:450
/[...]/includes/Page/LinkCache.php:489
/[...]/includes/Page/PageStore.php:186
/[...]/includes/Page/PageStore.php:153
/[...]/includes/Page/PageStore.php:325
/[...]/includes/Title/Title.php:3724
/[...]/includes/Title/Title.php:1069
/[...]/includes/Title/Title.php:1088
/[...]/extensions/ParserMigration/src/Oracle.php:138
/[...]/extensions/ParserMigration/src/Oracle.php:37
/[...]/extensions/MobileFrontend/includes/MobileFrontendHooks.php:1070
/[...]/extensions/MobileFrontend/tests/phpunit/integration/MobileFrontendHooksTest.php:525
=== Logs generated by test case
[...]
===

4) MobileFrontendHooksTest::testArticleParserOptions with data set "mobile, parsoid, main namespace" (true, true, 0, true)
RuntimeException: Database backend disabled

/[...]/includes/libs/Rdbms/LoadBalancer/LoadBalancerDisabled.php:57
/[...]/includes/Page/LinkCache.php:450
/[...]/includes/Page/LinkCache.php:489
/[...]/includes/Page/PageStore.php:186
/[...]/includes/Page/PageStore.php:153
/[...]/includes/Page/PageStore.php:325
/[...]/includes/Title/Title.php:3724
/[...]/includes/Title/Title.php:1069
/[...]/includes/Title/Title.php:1088
/[...]/extensions/ParserMigration/src/Oracle.php:138
/[...]/extensions/ParserMigration/src/Oracle.php:37
/[...]/extensions/MobileFrontend/includes/MobileFrontendHooks.php:1070
/[...]/extensions/MobileFrontend/tests/phpunit/integration/MobileFrontendHooksTest.php:525
=== Logs generated by test case
[...]
===

5) MobileFrontendHooksTest::testArticleParserOptions with data set "mobile, parsoid, file namespace" (true, true, 6, false)
RuntimeException: Database backend disabled

/[...]/includes/libs/Rdbms/LoadBalancer/LoadBalancerDisabled.php:57
/[...]/includes/Page/LinkCache.php:435
/[...]/includes/libs/ObjectCache/WANObjectCache.php:1831
/[...]/includes/libs/ObjectCache/WANObjectCache.php:1641
/[...]/includes/Page/LinkCache.php:431
/[...]/includes/Page/LinkCache.php:489
/[...]/includes/Page/PageStore.php:186
/[...]/includes/Page/PageStore.php:153
/[...]/includes/Page/PageStore.php:325
/[...]/includes/Title/Title.php:3724
/[...]/includes/Title/Title.php:1069
/[...]/includes/Title/Title.php:1088
/[...]/extensions/ParserMigration/src/Oracle.php:138
/[...]/extensions/ParserMigration/src/Oracle.php:37
/[...]/extensions/MobileFrontend/includes/MobileFrontendHooks.php:1070
/[...]/extensions/MobileFrontend/tests/phpunit/integration/MobileFrontendHooksTest.php:525
=== Logs generated by test case
[...]
===

6) MobileFrontendHooksTest::testArticleParserOptions with data set "mobile, parsoid, category namespace" (true, true, 14, false)
RuntimeException: Database backend disabled

/[...]/includes/libs/Rdbms/LoadBalancer/LoadBalancerDisabled.php:57
/[...]/includes/Page/LinkCache.php:435
/[...]/includes/libs/ObjectCache/WANObjectCache.php:1831
/[...]/includes/libs/ObjectCache/WANObjectCache.php:1641
/[...]/includes/Page/LinkCache.php:431
/[...]/includes/Page/LinkCache.php:489
/[...]/includes/Page/PageStore.php:186
/[...]/includes/Page/PageStore.php:153
/[...]/includes/Page/PageStore.php:325
/[...]/includes/Title/Title.php:3724
/[...]/includes/Title/Title.php:1069
/[...]/includes/Title/Title.php:1088
/[...]/extensions/ParserMigration/src/Oracle.php:138
/[...]/extensions/ParserMigration/src/Oracle.php:37
/[...]/extensions/MobileFrontend/includes/MobileFrontendHooks.php:1070
/[...]/extensions/MobileFrontend/tests/phpunit/integration/MobileFrontendHooksTest.php:525
=== Logs generated by test case
[...]
===

7) MobileFrontendHooksTest::testArticleParserOptions with data set "mobile, parsoid, special namespace" (true, true, -1, false)
InvalidArgumentException: WikiPage constructed on a Title that cannot exist as a page: Special:Test

/[...]/includes/Page/WikiPage.php:170
/[...]/includes/Page/Article.php:161
/[...]/includes/Page/Article.php:138
/[...]/extensions/MobileFrontend/tests/phpunit/integration/MobileFrontendHooksTest.php:522
=== Logs generated by test case
[...]
===

8) MobileFrontendHooksTest::testArticleParserOptions with data set "mobile, parsoid, media namespace" (true, true, -2, false)
InvalidArgumentException: WikiPage constructed on a Title that cannot exist as a page: Media:Test

/[...]/includes/Page/WikiPage.php:170
/[...]/includes/Page/Article.php:161
/[...]/includes/Page/Article.php:138
/[...]/extensions/MobileFrontend/tests/phpunit/integration/MobileFrontendHooksTest.php:522
=== Logs generated by test case
[...]
===

I believe that the reason that these test failures haven't been caught by WMF CI is because ext:ParserMigration isn't currently included as a CI dependency for MobileFrontend, and because MobileFrontend is set to skip these tests when the ParserMigration extension is not also loaded.


As far as I can see, there are two different test failures being reported by PHPUnit for this set of tests:

  • 6 RuntimeException: Database backend disabled errors, and
  • 2 InvalidArgumentException: WikiPage constructed on a Title that cannot exist as a page errors.

I believe that the Database backend disabled errors are due to the test class not being tagged with @group Database, and I will submit a patch to fix that.
I'll leave the WikiPage constructed on a Title that cannot exist as a page errors to the Reader Growth Team (and/or others) to handle, though, if that's okay. Testing locally, these failures actually seem to be a regression from https://gerrit.wikimedia.org/r/c/mediawiki/extensions/MobileFrontend/+/1219599 for T407815: Section collapsing applies to namespaces it should not apply to in mobile (so tagging Reader Growth Team on this task FYI).


Acceptance criteria

  • All tests pass when running composer phpunit -- extensions/MobileFrontend --filter "MobileFrontendHooksTest::testArticleParserOptions"
    • There are no RuntimeException: Database backend disabled test failures
    • There are no `InvalidArgumentException: WikiPage constructed on a Title that cannot exist as a page test failures
  • ParserMigration is added as a dependency of MobileFrontend in WMF CI (I assume this should also happen, to ensure that these tests are being run for patches submitted to MobileFrontend; but I defer to the Reader Growth Team on this as MobileFrontend's code stewards)

Event Timeline

A_smart_kitten updated Other Assignee, removed: A_smart_kitten.

I believe that the Database backend disabled errors are due to the test class not being tagged with @group Database, and I will submit a patch to fix that.

Actually, I've changed my mind -- I'll leave it for now. I can still submit a patch to do this if that's what folks would like (and tagging the class with @group Database does solve that test-error for me locally), but I'm not necessarily confident about whether doing this would be the right solution here (versus modifying the test to not interact with the database at all, I guess).

Edit: From following the stack-trace of the database-related test errors, the tests' attempts to access the database appear to stem from a content model check within ext:ParserMigration. In looking into these test errors, I happened to also come across https://gerrit.wikimedia.org/r/944301; and, following an approach used there, adding a call to $title->setContentModel( CONTENT_MODEL_WIKITEXT ); from within testArticleParserOptions also seems to resolve the database-related test-errors for me locally. I'm again not sure what the best solution would be for this, though.

Jdlrobson-WMF moved this task from Incoming/Inbox to Backlog on the Reader Growth Team board.
Jdlrobson-WMF moved this task from Backlog to Needs Refinement on the Reader Growth Team board.
HSwan-WMF set the point value for this task to 3.Thu, Jan 29, 5:55 PM