Skip to content

test(ci): enforce PHPUnit time limits with sensible timeout values#60739

Merged
miaulalala merged 1 commit into
masterfrom
perf/noid/phpunit-test-timeouts
May 27, 2026
Merged

test(ci): enforce PHPUnit time limits with sensible timeout values#60739
miaulalala merged 1 commit into
masterfrom
perf/noid/phpunit-test-timeouts

Conversation

@miaulalala
Copy link
Copy Markdown
Contributor

@miaulalala miaulalala commented May 26, 2026

Summary

  • Enable enforceTimeLimit in phpunit-autotest.xml and phpunit-autotest-external.xml — without this the timeout values are configured but never checked
  • Set realistic per-size limits: 60s / 300s / 600s for small / medium / large tests, with a 300s default for unannotated tests
  • Clear disable_functions in the PHP development ini preset across all PHPUnit workflows so pcntl_signal is available — required for PHPUnit's signal-based timeout enforcement to work

The LDAP mapping test speedup originally in this PR has been split into #60756.

Test plan

  • CI passes with timeouts enforced
  • No existing tests are killed by the new limits (all currently passing tests complete within 300s)

🤖 Generated with Claude Code

@miaulalala miaulalala requested review from skjnldsv and susnux May 26, 2026 15:20
@miaulalala miaulalala self-assigned this May 26, 2026
@miaulalala miaulalala added 3. to review Waiting for reviews performance 🚀 tests Related to tests CI labels May 26, 2026
@miaulalala miaulalala added this to the Nextcloud 35 milestone May 26, 2026
@miaulalala miaulalala marked this pull request as ready for review May 26, 2026 20:02
@miaulalala miaulalala requested a review from a team as a code owner May 26, 2026 20:02
@miaulalala miaulalala requested review from Altahrim, icewind1991, kesselb, provokateurin and salmart-dev and removed request for a team May 26, 2026 20:02
@kesselb
Copy link
Copy Markdown
Contributor

kesselb commented May 26, 2026

nit: I think "perf" implies improving performance of the actual application, not the test suite.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the PHPUnit configuration and CI workflows to actually enforce per-test time limits (with more realistic thresholds), and speeds up a particularly expensive LDAP mapping test by reducing unnecessary DB inserts.

Changes:

  • Enable PHPUnit time-limit enforcement and set new default/small/medium/large timeouts in the autotest XML configs.
  • Update GitHub Actions PHPUnit-related workflows to clear disable_functions when using ini-file: development, so pcntl_signal is available for enforced timeouts.
  • Reduce DB writes in AbstractMappingTestCase::testGetListOfIdsByDn() while keeping the query-chunking scenario.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/phpunit-autotest.xml Enables enforceTimeLimit and sets new default/size-based timeouts for the main server test suite.
tests/phpunit-autotest-external.xml Enables enforceTimeLimit and sets new default/size-based timeouts for files_external tests.
apps/user_ldap/tests/Mapping/AbstractMappingTestCase.php Cuts DB inserts in the chunking test to speed up execution.
.github/workflows/phpunit-sqlite.yml Clears disable_functions for development ini preset so PHPUnit timeouts can be enforced.
.github/workflows/phpunit-pgsql.yml Clears disable_functions for development ini preset so PHPUnit timeouts can be enforced.
.github/workflows/phpunit-oci.yml Clears disable_functions for development ini preset so PHPUnit timeouts can be enforced.
.github/workflows/phpunit-mysql.yml Clears disable_functions for development ini preset so PHPUnit timeouts can be enforced.
.github/workflows/phpunit-mysql-sharding.yml Clears disable_functions for development ini preset so PHPUnit timeouts can be enforced.
.github/workflows/phpunit-memcached.yml Clears disable_functions for development ini preset so PHPUnit timeouts can be enforced.
.github/workflows/phpunit-mariadb.yml Clears disable_functions for development ini preset so PHPUnit timeouts can be enforced.
.github/workflows/object-storage-swift.yml Clears disable_functions for development ini preset so PHPUnit timeouts can be enforced.
.github/workflows/object-storage-s3.yml Clears disable_functions for development ini preset so PHPUnit timeouts can be enforced.
.github/workflows/object-storage-azure.yml Clears disable_functions for development ini preset so PHPUnit timeouts can be enforced.
.github/workflows/files-external.yml Clears disable_functions for development ini preset so PHPUnit timeouts can be enforced.
.github/workflows/files-external-webdav.yml Clears disable_functions for development ini preset so PHPUnit timeouts can be enforced.
.github/workflows/files-external-smb.yml Clears disable_functions for development ini preset so PHPUnit timeouts can be enforced.
.github/workflows/files-external-s3.yml Clears disable_functions for development ini preset so PHPUnit timeouts can be enforced.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/user_ldap/tests/Mapping/AbstractMappingTestCase.php Outdated
Comment thread apps/user_ldap/tests/Mapping/AbstractMappingTestCase.php
Copy link
Copy Markdown
Member

@provokateurin provokateurin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove all changes unrelated to changing the phpunit configs.

@miaulalala miaulalala force-pushed the perf/noid/phpunit-test-timeouts branch from bc6e4d1 to 9ff8da0 Compare May 27, 2026 07:52
@miaulalala miaulalala changed the title perf(tests): enforce PHPUnit time limits with sensible timeout values test(ci): enforce PHPUnit time limits with sensible timeout values May 27, 2026
@miaulalala miaulalala requested a review from provokateurin May 27, 2026 07:54
@miaulalala
Copy link
Copy Markdown
Contributor Author

Needs #60756

@provokateurin
Copy link
Copy Markdown
Member

Please remove the unrelated workflow changes.

@miaulalala
Copy link
Copy Markdown
Contributor Author

/backport to stable34

@miaulalala
Copy link
Copy Markdown
Contributor Author

Please remove the unrelated workflow changes.

you mean disable_functions? That's needed so the timeouts work

PHPUnit's enforceTimeLimit was disabled, meaning the timeoutForSmallTests,
timeoutForMediumTests and timeoutForLargeTests config values had no effect.
Enable enforcement and set realistic limits: 60s/300s/600s for
small/medium/large, with a 300s default for unannotated tests.

Also clear disable_functions in the PHP development ini preset across all
PHPUnit workflows so pcntl_signal is available — without it the signal
handler that drives timeout enforcement cannot be registered.

Signed-off-by: Anna Larch <anna@nextcloud.com>
AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Anna Larch <anna@nextcloud.com>
@miaulalala miaulalala force-pushed the perf/noid/phpunit-test-timeouts branch from 9ff8da0 to 2c86e1d Compare May 27, 2026 09:42
@miaulalala miaulalala requested a review from blizzz May 27, 2026 15:51
@miaulalala miaulalala enabled auto-merge May 27, 2026 16:23
@miaulalala miaulalala merged commit 1272068 into master May 27, 2026
228 of 242 checks passed
@miaulalala miaulalala deleted the perf/noid/phpunit-test-timeouts branch May 27, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews blocked CI tests Related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants