Page MenuHomePhabricator

CleanupWatchlistLabelMemberTest fails on SQLite when running tests in parallel
Open, Needs TriagePublic

Description

We've been working on decreasing the gate pipeline times for core T422104 and going from 24 minutes to 14:30. One of the major things we done for PHPUnit is running the tests in parallel. That works really good for MySQL/Postgres. For SQLite we disabled parallel tests because we got lock issues (many threads writes to the same database).

With the changes we done so far the slowest tests now is the PHPUnit for SQLite. The median runtime for May 2026 so far is 11 minutes. If we can move SQLite tests to also run in parallel we have that all gated tests runs under 10 minutes. In https://gerrit.wikimedia.org/r/c/integration/quibble/+/1289330 we done a POC to setup up one database per worker to fix the locking issues. That works, however there's another failure that comes and goes (it's flaky):

00:05:22.693 Report from `split_group4`:
00:05:22.693 
00:05:22.693 There was 1 failure:
00:05:22.693 
00:05:22.693 1) MediaWiki\Tests\Maintenance\CleanupWatchlistLabelMemberTest::testCleanup
00:05:22.693 Failed asserting that 3 is identical to 4.
00:05:22.693 
00:05:22.693 /workspace/src/tests/phpunit/maintenance/CleanupWatchlistLabelMemberTest.php:41

The same tests runs just fine with MySQL and Postgres, this only happens for SQLite.

I made https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1289345 with some help from Claude but maybe there's a better way to fix it?

Event Timeline

Change #1289345 had a related patch set uploaded (by Phedenskog; author: Phedenskog):

[mediawiki/core@master] tests: make CleanupWatchlistLabelMemberTest run-order independent

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

The CI job, that passed, has the DatabaseSqliteUpgradeTest run in split 3, while in the failing job the test is running in the same split 4 group.
As DatabaseSqliteUpgradeTest is skipped for non-sqlite databases this was not seen before.

On the other side each test should start with empty tables due to MediaWikiIntegrationTestCase::truncateTables, but DatabaseSqliteUpgradeTest overrides the property MediaWikiIntegrationTestCase::$db with a mocked object, maybe this breaks some stuff from the tracking/clean up and the tables are not truncated.

Setting --force on the test would work for that test, not sure if DatabaseSqliteUpgradeTest needs some changes as well.

Change #1289345 abandoned by Phedenskog:

[mediawiki/core@master] tests: make CleanupWatchlistLabelMemberTest run-order independent

Reason:

This was just a test commit

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

Change #1289345 restored by Phedenskog:

[mediawiki/core@master] tests: make CleanupWatchlistLabelMemberTest run-order independent

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