[wp-trac] [WordPress Trac] #62830: Add a retry mechanism for tests that perform external HTTP requests

WordPress Trac noreply at wordpress.org
Mon Jan 20 15:44:13 UTC 2025


#62830: Add a retry mechanism for tests that perform external HTTP requests
------------------------------+--------------------
 Reporter:  johnbillion       |      Owner:  (none)
     Type:  enhancement       |     Status:  new
 Priority:  normal            |  Milestone:  6.8
Component:  Build/Test Tools  |    Version:
 Severity:  normal            |   Keywords:
  Focuses:                    |
------------------------------+--------------------
 PHPUnit tests that perform an external HTTP request are the worst. They
 rely on network connectivity and the behaviour of an external resource
 remaining stable. Although such tests mostly get skipped now if the
 request times out, other factors can still cause them to fail
 occasionally.

 While it would be great to eliminate most external HTTP requests in the
 PHPUnit tests, that's potentially quite a bit of work. I am proposing a
 simple wrapper for HTTP API requests in the tests which retries the
 request up to three times with a 5 second sleep between them. This reduces
 the chance that a temporary network connectivity problem will cause an
 otherwise passing test suite to fail.

 This is not meant to be a comprehensive solution to HTTP request retries,
 and I don't want to propose adding such behaviour to core (at the moment
 anyway). Rather this is a way of increasing the reliability of the test
 suite.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62830>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list