Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run tests on MW 1.34 / SMW 3.1.5 #61

Closed
samuell opened this issue Mar 20, 2020 · 1 comment
Closed

Can't run tests on MW 1.34 / SMW 3.1.5 #61

samuell opened this issue Mar 20, 2020 · 1 comment
Assignees
Labels

Comments

@samuell
Copy link
Member

samuell commented Mar 20, 2020

After applyng the fixes in #59 , I have been trying to get tests to work.

Following the guide for creating unit tests for extensions, I tried running a single test, but got:

$ php tests/phpunit/phpunit.php extensions/Rdfio/tests/phpunit/specials/SpecialSPARQLEndpoint_bodyTest.php
Using PHP 7.2.24-0ubuntu0.18.04.3
PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

Wikimedia\Rdbms\DBQueryError from line 1603 of /var/www/html/w/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?
Query: SELECT p.smw_title AS prop, o_id AS id0, o0.smw_title AS v0, o0.smw_namespace AS v1, o0.smw_iw AS v2, o0.smw_sortkey AS v3, o0.smw_subobject AS v4, o0.smw_sort AS v5 FROM `unittest_smw_di_wikipage` INNER JOIN `unittest_smw_object_ids` AS p ON p_id=p.smw_id INNER JOIN `unittest_smw_object_ids` AS o0 ON o_id=o0.smw_id WHERE (s_id='29') AND (p.smw_iw!=':smw') AND (p.smw_iw!=':smw-delete')
Function: SMW\SQLStore\EntityStore\SemanticDataLookup::fetchSemanticDataFromTable
Error: 1137 Can't reopen table: 'p' (localhost)

#0 /var/www/html/w/includes/libs/rdbms/database/Database.php(1574): Wikimedia\Rdbms\Database->getQueryExceptionAndLog('Can't reopen ta...', 1137, 'SELECT p.smw_ti...', 'SMW\\SQLStore\\En...')
#1 /var/www/html/w/includes/libs/rdbms/database/Database.php(1152): Wikimedia\Rdbms\Database->reportQueryError('Can't reopen ta...', 1137, 'SELECT p.smw_ti...', 'SMW\\SQLStore\\En...', false)
#2 /var/www/html/w/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->query('SELECT p.smw_ti...', 'SMW\\SQLStore\\En...', 0)
#3 /var/www/html/w/includes/libs/rdbms/database/DBConnRef.php(292): Wikimedia\Rdbms\DBConnRef->__call('query', Array)
#4 /var/www/html/w/extensions/SemanticMediaWiki/src/MediaWiki/Connection/Database.php(366): Wikimedia\Rdbms\DBConnRef->query('SELECT p.smw_ti...', 'SMW\\SQLStore\\En...', false)
#5 /var/www/html/w/extensions/SemanticMediaWiki/src/SQLStore/EntityStore/SemanticDataLookup.php(525): SMW\MediaWiki\Connection\Database->query('SELECT p.smw_ti...', 'SMW\\SQLStore\\En...')
#6 /var/www/html/w/extensions/SemanticMediaWiki/src/SQLStore/EntityStore/SemanticDataLookup.php(387): SMW\SQLStore\EntityStore\SemanticDataLookup->fetchFromTable(Object(SMW\MediaWiki\Connection\Query), Object(SMW\SQLStore\PropertyTableDefinition), true, Object(SMW\RequestOptions))
#7 /var/www/html/w/extensions/SemanticMediaWiki/src/SQLStore/EntityStore/CachingSemanticDataLookup.php(310): SMW\SQLStore\EntityStore\SemanticDataLookup->fetchSemanticDataFromTable(29, Object(SMW\DIWikiPage), Object(SMW\SQLStore\PropertyTableDefinition))
#8 /var/www/html/w/extensions/SemanticMediaWiki/src/SQLStore/EntityStore/CachingSemanticDataLookup.php(279): SMW\SQLStore\EntityStore\CachingSemanticDataLookup->fetchFromCache(29, Object(SMW\DIWikiPage), Object(SMW\SQLStore\PropertyTableDefinition))
#9 /var/www/html/w/extensions/SemanticMediaWiki/src/SQLStore/EntityStore/EntityLookup.php(296): SMW\SQLStore\EntityStore\CachingSemanticDataLookup->getSemanticData(29, Object(SMW\DIWikiPage), Object(SMW\SQLStore\PropertyTableDefinition), NULL)
#10 /var/www/html/w/extensions/SemanticMediaWiki/src/SQLStore/SQLStore.php(225): SMW\SQLStore\EntityStore\EntityLookup->getPropertyValues(Object(SMW\DIWikiPage), Object(SMW\DIProperty), NULL)
#11 /var/www/html/w/extensions/SemanticMediaWiki/src/Property/SpecificationLookup.php(116): SMW\SQLStore\SQLStore->getPropertyValues(Object(SMW\DIWikiPage), Object(SMW\DIProperty))
#12 /var/www/html/w/extensions/SemanticMediaWiki/src/Schema/SchemaFinder.php(68): SMW\Property\SpecificationLookup->getSpecification(Object(SMW\DIProperty), Object(SMW\DIProperty))
#13 /var/www/html/w/extensions/SemanticMediaWiki/src/DataModel/SequenceMap.php(41): SMW\Schema\SchemaFinder->newSchemaList(Object(SMW\DIProperty), Object(SMW\DIProperty))
#14 /var/www/html/w/extensions/SemanticMediaWiki/includes/SemanticData.php(473): SMW\DataModel\SequenceMap::canMap(Object(SMW\DIProperty))
#15 /var/www/html/w/extensions/SemanticMediaWiki/src/Property/Annotators/PredefinedPropertyAnnotator.php(74): SMW\SemanticData->addPropertyObjectValue(Object(SMW\DIProperty), Object(SMWDITime))
#16 /var/www/html/w/extensions/SemanticMediaWiki/src/Property/Annotators/PropertyAnnotatorDecorator.php(61): SMW\Property\Annotators\PredefinedPropertyAnnotator->addPropertyValues()
#17 /var/www/html/w/extensions/SemanticMediaWiki/src/Property/Annotators/PropertyAnnotatorDecorator.php(60): SMW\Property\Annotators\PropertyAnnotatorDecorator->addAnnotation()
#18 /var/www/html/w/extensions/SemanticMediaWiki/src/MediaWiki/Hooks/NewRevisionFromEditComplete.php(142): SMW\Property\Annotators\PropertyAnnotatorDecorator->addAnnotation()
#19 /var/www/html/w/extensions/SemanticMediaWiki/src/MediaWiki/Hooks/NewRevisionFromEditComplete.php(102): SMW\MediaWiki\Hooks\NewRevisionFromEditComplete->addPredefinedPropertyAnnotation(Object(SMW\Services\ServicesFactory), Object(SMW\ParserData), NULL)
#20 /var/www/html/w/extensions/SemanticMediaWiki/src/MediaWiki/Hooks.php(592): SMW\MediaWiki\Hooks\NewRevisionFromEditComplete->process()
#21 /var/www/html/w/includes/Hooks.php(174): SMW\MediaWiki\Hooks->onNewRevisionFromEditComplete(Object(WikiPage), Object(Revision), false, Object(User), Array)
#22 /var/www/html/w/includes/Hooks.php(202): Hooks::callHook('NewRevisionFrom...', Array, Array, NULL)
#23 /var/www/html/w/includes/Storage/PageUpdater.php(1134): Hooks::run('NewRevisionFrom...', Array)
#24 /var/www/html/w/includes/Storage/PageUpdater.php(758): MediaWiki\Storage\PageUpdater->doCreate(Object(CommentStoreComment), Object(User), 9)
#25 /var/www/html/w/includes/page/WikiPage.php(1931): MediaWiki\Storage\PageUpdater->saveRevision(Object(CommentStoreComment), 9)
#26 /var/www/html/w/tests/phpunit/MediaWikiIntegrationTestCase.php(1379): WikiPage->doEditContent(Object(WikitextContent), Object(CommentStoreComment), 9, false, Object(User))
#27 /var/www/html/w/tests/phpunit/MediaWikiIntegrationTestCase.php(439): MediaWikiIntegrationTestCase->addCoreDBData()
#28 /var/www/html/w/vendor/phpunit/phpunit/src/Framework/TestSuite.php(755): MediaWikiIntegrationTestCase->run(Object(MediaWikiTestResult))
#29 /var/www/html/w/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(545): PHPUnit\Framework\TestSuite->run(Object(MediaWikiTestResult))
#30 /var/www/html/w/vendor/phpunit/phpunit/src/TextUI/Command.php(195): PHPUnit\TextUI\TestRunner->doRun(Object(PHPUnit\Framework\TestSuite), Array, true)
#31 /var/www/html/w/tests/phpunit/phpunit.php(97): PHPUnit\TextUI\Command->run(Array, true)
#32 /var/www/html/w/maintenance/doMaintenance.php(99): PHPUnitMaintClass->execute()
#33 /var/www/html/w/tests/phpunit/phpunit.php(136): require('/var/www/html/w...')
#34 {main}
[83fc4c8b2f6043153e211763] [no req]   Wikimedia\Rdbms\DBTransactionError from line 1438 of /var/www/html/w/includes/libs/rdbms/database/Database.php: Explicit transaction still active. A caller may have caught an error. Open transactions: MediaWiki\Storage\PageUpdater::doCreate
Backtrace:
#0 /var/www/html/w/includes/libs/rdbms/loadbalancer/LoadBalancer.php(1602): Wikimedia\Rdbms\Database->assertNoOpenTransactions()
#1 /var/www/html/w/includes/libs/rdbms/loadbalancer/LoadBalancer.php(2109): Wikimedia\Rdbms\LoadBalancer->Wikimedia\Rdbms\{closure}(Wikimedia\Rdbms\DatabaseMysqli)
#2 /var/www/html/w/includes/libs/rdbms/loadbalancer/LoadBalancer.php(1621): Wikimedia\Rdbms\LoadBalancer->forEachOpenMasterConnection(Closure)
#3 /var/www/html/w/includes/libs/rdbms/lbfactory/LBFactory.php(208): Wikimedia\Rdbms\LoadBalancer->approveMasterChanges(array, string, integer)
#4 /var/www/html/w/includes/libs/rdbms/lbfactory/LBFactorySimple.php(134): Wikimedia\Rdbms\LBFactory->Wikimedia\Rdbms\{closure}(Wikimedia\Rdbms\LoadBalancer, string, array)
#5 /var/www/html/w/includes/libs/rdbms/lbfactory/LBFactory.php(210): Wikimedia\Rdbms\LBFactorySimple->forEachLB(Closure, array)
#6 /var/www/html/w/includes/libs/rdbms/lbfactory/LBFactory.php(269): Wikimedia\Rdbms\LBFactory->forEachLBCallMethod(string, array)
#7 /var/www/html/w/maintenance/doMaintenance.php(127): Wikimedia\Rdbms\LBFactory->commitMasterChanges(string)
#8 /var/www/html/w/tests/phpunit/phpunit.php(136): require(string)
#9 {main}
@samuell samuell added the bug label Mar 20, 2020
@samuell samuell self-assigned this Mar 20, 2020
@samuell
Copy link
Member Author

samuell commented Mar 20, 2020

Ah, tests can be run, if adding the --use-normal-tables cli flag to phpunit.php, as described in SemanticMediaWiki/SemanticScribunto#74:

$ php tests/phpunit/phpunit.php --use-normal-tables extensions/Rdfio/tests/phpunit/specials/SpecialSPARQLEndpoint_bodyTest.php 
Using PHP 7.2.24-0ubuntu0.18.04.3
PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

.......                                                             7 / 7 (100%)

Time: 9.56 seconds, Memory: 44.25MB

OK (7 tests, 15 assertions)

@samuell samuell closed this as completed Mar 20, 2020
samuell added a commit that referenced this issue Mar 20, 2020
…m in MySQL (see #61)

Enforce --use-normal-tables in ci script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant