Page MenuHomePhabricator

CompareServiceTest::testGetTargetsOverLimit() test failures
Closed, ResolvedPublic

Description

Seen on an Echo patch https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Echo/+/856026

https://integration.wikimedia.org/ci/job/quibble-vendor-sqlite-php74-noselenium-docker/40/console

16:16:37 There were 2 failures:
16:16:37 
16:16:37 1) MediaWiki\CheckUser\Tests\Integration\Investigate\Services\CompareServiceTest::testGetTargetsOverLimit with data set "One target is over limit" (array(array('1.2.3.4', 'User1', '1.2.3.5'), array('1.2.3.5'), 4), array('1.2.3.4'))
16:16:37 Failed asserting that two arrays are equal.
16:16:37 --- Expected
16:16:37 +++ Actual
16:16:37 @@ @@
16:16:37  Array (
16:16:37 -    0 => '1.2.3.4'
16:16:37  )
16:16:37 
16:16:37 /workspace/src/extensions/CheckUser/tests/phpunit/integration/Investigate/Services/CompareServiceTest.php:286
16:16:37 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:518
16:16:37 === Logs generated by test case
16:16:37 [objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
16:16:37 [localisation] [debug] LocalisationCache using store LCStoreNull []
16:16:37 [objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
16:16:37 ===
16:16:37 
16:16:37 2) MediaWiki\CheckUser\Tests\Integration\Investigate\Services\CompareServiceTest::testGetTargetsOverLimit with data set "Two targets are over limit" (array(array('1.2.3.4', '1.2.3.5'), 1), array('1.2.3.4', '1.2.3.5'))
16:16:37 Failed asserting that two arrays are equal.
16:16:37 --- Expected
16:16:37 +++ Actual
16:16:37 @@ @@
16:16:37  Array (
16:16:37 -    0 => '1.2.3.4'
16:16:37 -    1 => '1.2.3.5'
16:16:37  )
16:16:37 
16:16:37 /workspace/src/extensions/CheckUser/tests/phpunit/integration/Investigate/Services/CompareServiceTest.php:286
16:16:37 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:518
16:16:37 === Logs generated by test case
16:16:37 [objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
16:16:37 [localisation] [debug] LocalisationCache using store LCStoreNull []
16:16:37 [objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
16:16:37 ===
16:16:37 
16:16:37 FAILURES!
16:16:37 Tests: 1075, Assertions: 2796, Failures: 2, Skipped: 14.

Event Timeline

Previous edition: T317411, but I don't think it's related to this one. getTargetsOverLimit starts with:

if ( !$dbr->unionSupportsOrderAndLimit() ) {
	return [];
}

and that condition is true for SQLite. I guess the expected value should be changed to [] if using SQLite as the DBMS,

Dreamy_Jazz subscribed.

This task makes sqlite not compatible with CheckUser when running phpunit tests. As such, this blocks bundling CheckUser as there needs to be full support for sqlite.

Change 872995 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/CheckUser@master] Test when DB does not support ORDER and LIMIT in a UNION

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

Change 872995 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Fix tests for when DB does not support ORDER and LIMIT in a UNION

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

Thanks for the quick merge. This should now be resolved (as long as the issue is constrained to what Daimona described).