Page MenuHomePhabricator

[Infra] Implement a stable ordering for tests in PHPUnit parallel test runs
Closed, ResolvedPublic

Description

The current composer-based implementation of PHPUnit parallel test runs collects the tests to run by crawling the filesystem. This means that the ordering of the tests is dependent on the order in which the files were written to disk, which is not stable over different testing environments (for example, a fresh checkout from Zuul vs. a developer's local machine).

This is an issue for us as some tests are not fully isolated from one another in their setup and teardown. The unpredictable order of test runs (which also changes between machines) makes it hard to reproduce and diagnose test run failures where test ordering is responsible for the issue. Having a predictable order will assist us in diagnosing which tests are failing for these reasons and remedy them in the future.

Acceptance Criteria

  • The composer phpunit:prepare-parallel:extensions task implements a stable ordering of the test cases within the split groups - for example an alphabetical ordering.

Details

Event Timeline

@ArthurTaylor while reviewing the task we were wondering what is the importance / effect of ordering the test alphabetically, We added some text to try and explain the motivation please feel free to correct any wrong assumptions.

Prio Notes:

Impact AreaAffected
production / end usersno
monitoringno
development effortsyes
onboarding effortsno
additional stakeholdersyes (flaky tests affect other teams)
ItamarWMDE renamed this task from Implement a stable ordering for tests in PHPUnit parallel test runs to [Infra] Implement a stable ordering for tests in PHPUnit parallel test runs.Oct 10 2024, 10:50 AM

@ItamarWMDE Looks good - thank you! I just changed a couple of words.

Change #1079471 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):

[mediawiki/core@master] Sort tests in PHPUnit Parallel test suites by name

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

Change #1079471 merged by jenkins-bot:

[mediawiki/core@master] Sort tests in PHPUnit Parallel test suites by name

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