Page MenuHomePhabricator

Math tests dies when run with the Echo extensions
Closed, ResolvedPublic

Description

I have tried running the unit tests with both Echo and Math installed and ends up with a database error:

$ ls -1 extensions
Echo
Math
README
$ cd tests/phpunit
$ php phpunit.php --tap --testsuite extensions
not ok 588 - Error: MathDatabaseTest::testCreateTable
A database query error has occurred.
Query: DELETE FROM unittest_math
Function: MediaWikiTestCase::resetDB
Error: 1 no such table: unittest_math


---

#0 /core/includes/db/Database.php(1134): DatabaseBase->reportQueryError('no such table: ...', 1, 'DELETE FROM uni...', 'MediaWikiTestCa...', false)
#1 /core/includes/db/Database.php(2919): DatabaseBase->query('DELETE FROM uni...', 'MediaWikiTestCa...')
#2 /core/tests/phpunit/MediaWikiTestCase.php(572): DatabaseBase->delete('math', '*', 'MediaWikiTestCa...')
#3 /core/tests/phpunit/MediaWikiTestCase.php(138): MediaWikiTestCase->resetDB()
#4 /pear/PHPUnit/Framework/TestSuite.php(775): MediaWikiTestCase->run(Object(PHPUnit_Framework_TestResult))
#5 /pear/PHPUnit/Framework/TestSuite.php(745): PHPUnit_Framework_TestSuite->runTest(Object(MathDatabaseTest), Object(PHPUnit_Framework_TestResult))
#6 /pear/PHPUnit/Framework/TestSuite.php(705): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult), false, Array, Array, false)
#7 /pear/PHPUnit/Framework/TestSuite.php(705): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult), false, Array, Array, false)
#8 /pear/PHPUnit/Framework/TestSuite.php(705): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult), false, Array, Array, false)
#9 /pear/PHPUnit/TextUI/TestRunner.php(349): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult), false, Array, Array, false)
#10 /pear/PHPUnit/TextUI/Command.php(176): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array)
#11 /core/tests/phpunit/MediaWikiPHPUnitCommand.php(42): PHPUnit_TextUI_Command->run(Array, true)
#12 /core/tests/phpunit/phpunit.php(160): MediaWikiPHPUnitCommand::main()
#13 {main}

Also the Math extension seems to be running the updater in the test.


Version: unspecified
Severity: normal

Details

Reference
bz67148

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 3:26 AM
bzimport set Reference to bz67148.
bzimport added a subscriber: Unknown Object (MLST).

tests/MathDatabaseTest.php has:

public function testCreateTable() {

...
$dbu->doUpdates( array( "extensions" ) );
...

among other. Commenting out the function let us continue the test suite.

physik wrote:

did you run update.php before?
As far as I understand the database tests copy the schema with and prefix the tables with untitest. If there is no math table in the base schema no table will be created in the copied unittest schema.
The database test tries to delete the test schema and creates a new one.
We should either improve the error message or ignore the missing math table in the main database. I don't know which option is better?

I did ran update.php

A slightly more complicated test I ran in Jenkins is:

https://integration.wikimedia.org/ci/job/mediawiki-core-extensions-integration/38/consoleFull

It clones a bunch of extensions, load their entry points then run install.php and then update.php

00:01:04.861 Creating math table ...done.

The dberror:

Thu Jun 26 16:15:01 UTC 2014 gallium build38-unittest_ MediaWikiTestCase::resetDB 1 no such table: unittest_math DELETE FROM unittest_math

Change 142739 had a related patch set uploaded by Physikerwelt:
Fix MathDatabaseTest

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

We really need tests to pass when all wmf extensions are installed together. That is preventing us from progression toward the HHVM migrating. Raising priority to High.

physik wrote:

does the problem disappear if you disable the Echo module?
Are those tests using sqlite?

Sure! See comment 1. Install a stock MediaWiki core with extensions Echo and Math. That should trigger the issue.

Change 142739 merged by jenkins-bot:
Fix MathDatabaseTest

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

Antoine, is it fine for you now?

Still the same error with latest master of Math Echo and core:

not ok 588 - Error: MathDatabaseTest::testCreateTable
A database query error has occurred.
Query: DELETE FROM unittest_math
Function: MediaWikiTestCase::resetDB
Error: 1 no such table: unittest_math

  • Bug 68628 has been marked as a duplicate of this bug. ***

physik wrote:

This Bug is not related to the math extension.
My experience is the following
At first I could reproduce a similar error as reported in the bug report. But the error indicated that database access related to the echo extension caused the error.
To investigate further I changed the order in the Localsettings.php an loaded Math before echo.
I wanted to reproduce exactly the problem that you had reported before. But no error occurred. After switching the order back the error did not come back.
AS a result I think the error is not related to the Math extension, rather to the sqllite db backend. Especially given the fact that the error does not occur with mysql

hashar set Security to None.

Would need to be tried again, it might have been fixed.

This original problem reported seems to be fixed now.
Hoever, there is another unrelated error

ok 948 - ResourcesTest::testStyleMedia with data set #13 ('skins.vector.styles', 'screen and (min-width: 982px)', 'screen-hd.less', stdClass Object (...))
ok 949 - ResourcesTest::testIllegalDependencies
not ok 950 - Failure: ResourcesTest::testMissingDependencies
  ---
  message: 'The module ''ext.visualEditor.mwcore'' required by ''ext.math.visualEditor'' must exist'
  severity: fail
  ...
not ok 951 - Error: ResourcesTest::testUnsatisfiableDependencies
ok 952 - ResourcesTest::testMediaWikiTestCaseParentSetupCalled