Opened 2 years ago
Closed 2 years ago
#55919 closed defect (bug) (fixed)
Composer: Disable process timeout for PHPUnit tests
Reported by: | SergeyBiryukov | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 6.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch has-testing-info |
Focuses: | Cc: |
Description
When running npm run grunt phpunit:multisite
locally, I get an error around 80%:
The following exception is caused by a process timeout Check https://getcomposer.org/doc/06-config.md#process-timeout for details In Process.php line 1204: The process "'/usr/bin/php7.4' -d allow_url_fopen='1' -d disable_functions='' -d memory_limit='-1' ./vendor/phpunit /phpunit/phpunit '--verbose' '-c' 'tests/phpunit/multisite.xml'" exceeded the timeout of 300 seconds. test [--dev] [--no-dev] [--] [<args>...] Warning: Use --force to continue. Aborted due to warnings. npm ERR! code ELIFECYCLE npm ERR! errno 3 npm ERR! WordPress@6.1.0 grunt: `grunt "phpunit:multisite"` npm ERR! Exit status 3 npm ERR! npm ERR! Failed at the WordPress@6.1.0 grunt script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
This appears to be caused by Composer's default timeout of 300 seconds. Disabling the timeout as suggested in the documentation resolves the issue for me.
Attachments (1)
Change History (7)
#3
@
2 years ago
- Keywords has-testing-info added
Reproduction Report
I am able to force the reported error by setting Composer's process-timeout
value to less than the time expected to run the multisite unit test suite (in my case, this takes ~2.5 minutes).
Environment
- Hardware: MacBook Pro Apple M1 Pro
- OS: macOS 12.6
- Server: nginx/1.23.1
- PHP: 7.4.30
- WordPress: 6.1-alpha-53344-src
Pre-Test Configuration
- Set Composer's
process-timeout
to a low value (e.g. 10 seconds) to simulate an insufficient timeout period:export COMPOSER_PROCESS_TIMEOUT=10
. - Confirm the
process-timeout
value with:composer config process-timeout
.
Actual Results
- ✅ Error occurs after ~10 seconds (per
process-timeout
override above):The following exception is caused by a process timeout Check https://getcomposer.org/doc/06-config.md#process-timeout for details In Process.php line 1204: The process "'/opt/homebrew/Cellar/php@7.4/7.4.30_1/bin/php' -d allow_url_fopen='1' -d disable_ functions='' -d memory_limit='1536M' ./vendor/phpunit/phpunit/phpunit '--verbose' '-c' 'tests/p hpunit/multisite.xml'" exceeded the timeout of 10 seconds. test [--dev] [--no-dev] [--] [<args>...] Warning: Use --force to continue. Aborted due to warnings. npm ERR! code ELIFECYCLE npm ERR! errno 3 npm ERR! WordPress@6.1.0 grunt: `grunt "phpunit:multisite"` npm ERR! Exit status 3 npm ERR! npm ERR! Failed at the WordPress@6.1.0 grunt script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /<redacted>/.npm/_logs/2022-09-21T05_06_59_646Z-debug.log
Additional Notes
- Bypassing Composer and running
phpunit --verbose -c tests/phpunit/multisite.xml
directly will not reproduce the issue.
#4
@
2 years ago
Test Report
LGTM 👍🏻 As indicated above, this can be tested by forcing an insufficient time period to complete the test suite.
Patch tested: https://core.trac.wordpress.org/attachment/ticket/55919/55919.diff
Environment
- Hardware: MacBook Pro Apple M1 Pro
- OS: macOS 12.6
- Server: nginx/1.23.1
- PHP: 7.4.30
- WordPress: 6.1-alpha-53344-src
Pre-Test Configuration
- Set Composer's
process-timeout
to a low value (e.g. 10 seconds) to simulate an insufficient timeout period:export COMPOSER_PROCESS_TIMEOUT=10
. - Confirm the
process-timeout
value with:composer config process-timeout
.
Actual Results
- ✅ Patch update overrides
process-timeout
value and tests complete without error.
This ticket was mentioned in Slack in #core by robinwpdeveloper. View the logs.
2 years ago
Note: See
TracTickets for help on using
tickets.
Much needed. Thanks @SergeyBiryukov