Page MenuHomePhabricator

Coverage of ApiQuerySiteinfoTest:testContinuation takes 50+ seconds
Closed, ResolvedPublic

Description

When generating mediawiki core code coverage, the suite complains about ApiQuerySiteinfoTest:testContinuation taking too long:

You should really fix these slow tests (>50ms)...
19:19:44  1. 52277ms to run ApiQuerySiteinfoTest:testContinuation

The test has been introduced by @Simetrical with 27d41f442aa2d4f7c1f90b8af9265874aa4239ea
// https://gerrit.wikimedia.org/r/426765

It notably populates $wgUrlProtocols with ~ 86000 entries in order to forge a huge response when doing:

$res = $this->doApiRequest( [
    'action' => 'query',
    'meta' => 'siteinfo',
    'siprop' => 'protocols|languages',
] );

The code thus has to pass through the 86 000 entries which causes a lot of overhead when doing a coverage report.

Running it locally:

$ php tests/phpunit/phpunit.php tests/phpunit/includes/api/ApiQuerySiteinfoTest.php --filter testContinuation
Using PHP 7.3.9-1~deb10u1
PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

.                                                                   1 / 1 (100%)

You should really fix these slow tests (>50ms)...
 1. 231ms to run ApiQuerySiteinfoTest:testContinuation

The test should be refactored, possibly by setting $wgAPIMaxResultSize to a lower value which should be enough to trigger the apiwarn-truncatedresult / testing the continuation.

Details

Related Gerrit Patches:

Event Timeline

Restricted Application added a project: Core Platform Team. · View Herald TranscriptSep 27 2019, 8:27 AM

Change 539494 had a related patch set uploaded (by Hashar; owner: Hashar):
[mediawiki/core@master] Speed up ApiQuerySiteinfoTest:testContinuation

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

hashar triaged this task as Medium priority.Sep 27 2019, 1:23 PM

Change 539494 merged by jenkins-bot:
[mediawiki/core@master] Speed up ApiQuerySiteinfoTest:testContinuation

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

Anomie closed this task as Resolved.Sep 27 2019, 1:49 PM
Anomie assigned this task to hashar.