Page MenuHomePhabricator

Restore Skip ApiMobileViewTest::testView and verify PHP unit tests for RelatedArticles pass
Closed, ResolvedPublic

Description

RelatedArticles unit tests were failing.
The issue originated inside MobileFrontend even though MobileFrontend's unit tests do not fail.. (weird..)

it appears to be related to the Vector skin not being installed.

We skipped the test to unblock reviews.

Restore the test and verify the tests pass inside RelatedArticles.

22:38:03 Time: 2.35 minutes, Memory: 186.16MB
22:38:03 
22:38:03 There were 5 errors:
22:38:03 
22:38:03 1) ApiMobileViewTest::testView with data set #0 (array('mobileview', 'Foo', '1-', '', 'Lead\n== Section 1 ==\nText 1\n=...ext 2\n'), array(array(array(0), array(1, 'Section 1', 1, '<p>Text 1</p>'), array(1, 'Section 2', 2, '<p>Text 2</p>'))))
22:38:03 BadMethodCallException: Call to a member function isMainPage() on a non-object (null)
22:38:03 
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/skins/MinervaNeue/includes/skins/SkinMinerva.php:200
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/skins/MinervaNeue/includes/skins/SkinMinerva.php:228
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/includes/parser/ParserOutput.php:272
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/includes/parser/ParserOutput.php:275
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/tests/phpunit/api/ApiMobileViewTest.php:25
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/includes/api/ApiMobileView.php:614
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/includes/api/ApiMobileView.php:129
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/tests/phpunit/api/ApiMobileViewTest.php:140
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/tests/phpunit/api/ApiMobileViewTest.php:173
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/tests/phpunit/MediaWikiTestCase.php:415
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/maintenance/doMaintenance.php:111
22:38:03 
22:38:03 2) ApiMobileViewTest::testView with data set #1 (array('mobileview', 'Foo', '1-', '', 'Lead\n== Section 1 ==\nText 1\n=...ext 2\n', 'text'), array(array(array(1, '<p>Text 1</p>'), array(2, '<p>Text 2</p>'))))
22:38:03 BadMethodCallException: Call to a member function isMainPage() on a non-object (null)
22:38:03 
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/skins/MinervaNeue/includes/skins/SkinMinerva.php:200
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/skins/MinervaNeue/includes/skins/SkinMinerva.php:228
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/includes/parser/ParserOutput.php:272
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/includes/parser/ParserOutput.php:275
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/tests/phpunit/api/ApiMobileViewTest.php:25
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/includes/api/ApiMobileView.php:614
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/includes/api/ApiMobileView.php:129
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/tests/phpunit/api/ApiMobileViewTest.php:140
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/tests/phpunit/api/ApiMobileViewTest.php:173
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/tests/phpunit/MediaWikiTestCase.php:415
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/maintenance/doMaintenance.php:111
22:38:03 
22:38:03 3) ApiMobileViewTest::testView with data set #2 (array(1, '', 'mobileview', 'Foo', '', 'Lead\n== Section 1 ==\nText 1\n=...ext 2\n'), array(array(array(1, 'Section 1', 1, '<p>Text 1</p>'))))
22:38:03 BadMethodCallException: Call to a member function isMainPage() on a non-object (null)
22:38:03 
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/skins/MinervaNeue/includes/skins/SkinMinerva.php:200
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/skins/MinervaNeue/includes/skins/SkinMinerva.php:228
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/includes/parser/ParserOutput.php:272
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/includes/parser/ParserOutput.php:275
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/tests/phpunit/api/ApiMobileViewTest.php:25
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/includes/api/ApiMobileView.php:614
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/includes/api/ApiMobileView.php:129
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/tests/phpunit/api/ApiMobileViewTest.php:140
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/tests/phpunit/api/ApiMobileViewTest.php:173
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/tests/phpunit/MediaWikiTestCase.php:415
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/maintenance/doMaintenance.php:111
22:38:03 
22:38:03 4) ApiMobileViewTest::testView with data set #3 (array('Main Page', 1, '', 'mobileview', '', 'Lead\n== Section 1 ==\nText 1\n=...ext 2\n'), array('', array()))
22:38:03 BadMethodCallException: Call to a member function isMainPage() on a non-object (null)
22:38:03 
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/skins/MinervaNeue/includes/skins/SkinMinerva.php:200
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/skins/MinervaNeue/includes/skins/SkinMinerva.php:228
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/includes/parser/ParserOutput.php:272
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/includes/parser/ParserOutput.php:275
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/tests/phpunit/api/ApiMobileViewTest.php:25
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/includes/api/ApiMobileView.php:614
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/includes/api/ApiMobileView.php:129
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/tests/phpunit/api/ApiMobileViewTest.php:140
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/tests/phpunit/api/ApiMobileViewTest.php:173
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/tests/phpunit/MediaWikiTestCase.php:415
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/maintenance/doMaintenance.php:111
22:38:03 
22:38:03 5) ApiMobileViewTest::testView with data set #6 (array('Main Page', 1, true, 'namespace', 'mobileview', '', 'Lead\n== Section 1 ==\nText 1\n=...ext 2\n'), array('', array(), 0))
22:38:03 BadMethodCallException: Call to a member function isMainPage() on a non-object (null)
22:38:03 
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/skins/MinervaNeue/includes/skins/SkinMinerva.php:200
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/skins/MinervaNeue/includes/skins/SkinMinerva.php:228
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/includes/parser/ParserOutput.php:272
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/includes/parser/ParserOutput.php:275
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/tests/phpunit/api/ApiMobileViewTest.php:25
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/includes/api/ApiMobileView.php:614
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/includes/api/ApiMobileView.php:129
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/tests/phpunit/api/ApiMobileViewTest.php:140
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/extensions/MobileFrontend/tests/phpunit/api/ApiMobileViewTest.php:173
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/tests/phpunit/MediaWikiTestCase.php:415
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/maintenance/doMaintenance.php:111
22:38:03 
22:38:03 --
22:38:03 
22:38:03 There were 2 failures:
22:38:03 
22:38:03 1) ParserIntegrationTest::testParse with data set "luaParserTests.txt: Scribunto: expandTemplate with headers" ('[details omitted]')
22:38:03 Failed asserting that two strings are equal.
22:38:03 --- Expected
22:38:03 +++ Actual
22:38:03 @@ @@
22:38:03 -'<h2><span class="mw-headline" id="foo">foo</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22:38:03 -<h2><span class="mw-headline" id="bar">bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Scribunto_template_with_headers&amp;action=edit&amp;section=T-1" title="Template:Scribunto template with headers">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22:38:03 +'<h2><span class="mw-headline" id="foo">foo</span><span><a href="/index.php?title=API&amp;action=edit&amp;section=1" title="Edit section: foo" data-section="1" class="mw-ui-icon mw-ui-icon-element mw-ui-icon-edit-enabled edit-page">Edit</a></span></h2>
22:38:03 +<h2><span class="mw-headline" id="bar">bar</span><span><a href="/index.php?title=API&amp;action=edit&amp;section=T-1" title="Edit section: " data-section="T-1" class="mw-ui-icon mw-ui-icon-element mw-ui-icon-edit-enabled edit-page">Edit</a></span></h2>
22:38:03  '
22:38:03 
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/tests/phpunit/includes/parser/ParserIntegrationTest.php:37
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/maintenance/doMaintenance.php:111
22:38:03 
22:38:03 2) ParserIntegrationTest::testParse with data set "citeParserTests.txt: <ref>s with the follow parameter" ('[details omitted]')
22:38:03 Failed asserting that two strings are equal.
22:38:03 --- Expected
22:38:03 +++ Actual
22:38:03 @@ @@
22:38:03  '<p>Page one.<sup id="cite_ref-beginning_1-0" class="reference"><a href="#cite_note-beginning-1">&#91;1&#93;</a></sup>
22:38:03  </p><p>Page two.
22:38:03  </p>
22:38:03 -<h2><span class="mw-headline" id="References">References</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: References">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22:38:03 +<h2><span class="mw-headline" id="References">References</span><span><a href="/index.php?title=API&amp;action=edit&amp;section=1" title="Edit section: References" data-section="1" class="mw-ui-icon mw-ui-icon-element mw-ui-icon-edit-enabled edit-page">Edit</a></span></h2>
22:38:03  <div class="mw-references-wrap"><ol class="references">
22:38:03  <li id="cite_note-beginning-1"><span class="mw-cite-backlink"><a href="#cite_ref-beginning_1-0">↑</a></span> <span class="reference-text">First page footnote text. Second page footnote text.</span>
22:38:03  </li>
22:38:03  </ol></div>
22:38:03  '
22:38:03 
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/tests/phpunit/includes/parser/ParserIntegrationTest.php:37
22:38:03 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/maintenance/doMaintenance.php:111
22:38:03 
22:38:03 FAILURES!
22:38:03 Tests: 5379, Assertions: 20377, Errors: 5, Failures: 2, Skipped: 16, Risky: 1.
22:38:03 Build step 'Execute shell' marked build as failure
22:38:03 Recording test results
22:38:07 [PostBuildScript] - Execution post build scripts.
22:38:07 [PostBuildScript] Build is not success : do not execute script
22:38:07 Archiving artifacts
22:38:09 Finished: FAILURE

Previously

Unit tests in MinervaNeue were a problem. These have since been fixed.

https://integration.wikimedia.org/ci/job/mwext-testextension-hhvm-jessie/10924/console

18:40:06 1) Tests\MobileFrontend\Skins\SkinMinervaTest::testGetContextSpecificModules with data set #0 (true, false, 'skins.minerva.fontchanger', true)
18:40:06 BadMethodCallException: Call to a member function inNamespace() on a non-object (null)
18:40:06 
18:40:06 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/skins/MinervaNeue/includes/skins/SkinUserPageHelper.php:37
18:40:06 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/skins/MinervaNeue/includes/skins/SkinUserPageHelper.php:59
18:40:06 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/skins/MinervaNeue/includes/skins/SkinMinerva.php:201
18:40:06 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/skins/MinervaNeue/includes/skins/SkinMinerva.php:1252
18:40:06 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/vendor/wikimedia/testing-access-wrapper/src/TestingAccessWrapper.php:72
18:40:06 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/skins/MinervaNeue/tests/phpunit/skins/SkinMinervaTest.php:190
18:40:06 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/tests/phpunit/MediaWikiTestCase.php:415
18:40:06 /home/jenkins/workspace/mwext-testextension-hhvm-jessie/src/maintenance/doMaintenance.php:111
18:40:06

Theories

I suspect this test fails when MobileFrontend is not present or Minerva is included before MobileFrontend

Event Timeline

Interestingly these PHP unit tests fail locally for me when not using hhvm. I can only assume that when RelatedArticles phpunit tests run against MinervaNeue they are running under a different context to MinervaNeue as test-skins passes on current master for MinervaNeue.

I believe test-skins (used on MinervaNeue) works differently from extension-unittests-generic (used by RelatedArticles) but I can't really grok the config to understand that. Anyone who understands those jobs able to help me?

Change 365678 had a related patch set uploaded (by Thcipriani; owner: Thcipriani):
[integration/config@master] Remove MinervaNeue from the MobileFrontend dependencies

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

Change 365678 abandoned by Thcipriani:
Remove MinervaNeue from the MobileFrontend dependencies

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

This is causing issues with the train so I've pulled it into the current sprint.

Change 365689 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/skins/MinervaNeue@master] SkinMinerva testGetContextSpecificModule test might use undefined title

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

Change 365689 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] SkinMinerva testGetContextSpecificModule test might use undefined title

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

Change 365801 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/core@master] PHPUnitTets skins testsuite should pick up skins tests

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

Change 365801 abandoned by Pmiazga:
PHPUnitTets skins testsuite should pick up skins tests

Reason:
Not required as it is possible to tell CI to execute test suite both for skin and extension. Skins testsuite executes only tests/phpunit/skins testcases, and extension testsuite executes skin specific unit tests.

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

Change 365711 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/skins/MinervaNeue@master] Fix failing SkinMinerva unit test

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

Change 365711 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Fix failing SkinMinerva unit test

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

Jdlrobson renamed this task from RelatedPages PHP unit tests are failing during to an issue with MinervaNeue to RelatedPages PHP unit tests are failing during to an issue with MobileFrontend.Jul 17 2017, 10:42 PM
Jdlrobson removed Jdlrobson as the assignee of this task.
Jdlrobson lowered the priority of this task from High to Medium.
Jdlrobson edited projects, added MobileFrontend; removed MinervaNeue.
Jdlrobson updated the task description. (Show Details)
Jdlrobson removed a project: Patch-For-Review.
Jdlrobson updated the task description. (Show Details)

I've dropped to normal and out of the sprint since this is no longer blocking the train, but it still remains unfixed. I've put in upcoming to discuss for the next sprint.

Change 366249 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/extensions/MobileFrontend@master] Unit tests have to use global RequestContext

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

Change 366288 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/extensions/MobileFrontend@master] Skip ApiMobileViewTest::testView() as it is not possible to reproduce

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

Change 366288 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Skip ApiMobileViewTest::testView() as it is not possible to reproduce

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

Jdlrobson renamed this task from RelatedPages PHP unit tests are failing during to an issue with MobileFrontend to Restore Skip ApiMobileViewTest::testView and verify PHP unit tests for RelatedArticles pass.Jul 25 2017, 6:45 PM
Jdlrobson updated the task description. (Show Details)
greg subscribed.

As far as I can tell there is nothing for RelEng to do here. This is "simply" a matter of bad interaction between some tests/extensions.

@pmiazga I found the problem. If you can take a look at the amended https://gerrit.wikimedia.org/r/#/c/366496 I'll merge with your blessing.

Change 366249 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Re-enable ApiMobileViewTest and use fallback skin in tests

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