Conversation
|
Size Change: +1.88 kB (0%) Total Size: 1.33 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 7b4623e. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3975867423
|
| RUN echo 'xdebug.start_with_request=yes' >> /usr/local/etc/php/php.ini | ||
| RUN echo 'xdebug.mode=${ enableXdebug }' >> /usr/local/etc/php/php.ini | ||
| RUN echo '${ clientDetectSettings }' >> /usr/local/etc/php/php.ini | ||
| RUN HOST_IP=$(ip route | awk '/default/ { print $3 }'); echo "xdebug.client_host=\"$HOST_IP\"" >> /usr/local/etc/php/php.ini |
There was a problem hiding this comment.
When PHPUnit is used, xdebug is not able to detect host ip within the docker container. It can do it through the browser because of some HTTP fields, but that doesn't exist in the CLI. The host IP is the "default gateway" within the docker container, which can be seen using the ip route command. This extracts the default gateway from the ip route command and sets it as host ip.
| volumes: developmentMounts, | ||
| }, | ||
| 'tests-wordpress': { | ||
| build: '.', |
There was a problem hiding this comment.
Does this break how testsPhpVersion sets the PHP version for the tests-wordpress environment?
There was a problem hiding this comment.
It does. Well spotted. I changed the code now so that if testsPhpVersion is set, xdebug will not work. I don't have the time to add compatibility for that, but at least if someone does specify this in their config, they will get that php version in tests.
What?
While working on #46952 I found it would be useful to be able to run xdebug in PHP unit tests. This PR makes it possible.