[wp-trac] [WordPress Trac] #57306: External HTTP test failures

WordPress Trac noreply at wordpress.org
Sat Dec 10 02:52:51 UTC 2022


#57306: External HTTP test failures
------------------------------+--------------------
 Reporter:  SergeyBiryukov    |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  6.2
Component:  Build/Test Tools  |    Version:
 Severity:  normal            |   Keywords:
  Focuses:                    |
------------------------------+--------------------
 Some external HTTP tests
 [https://wordpress.slack.com/archives/C02RQBWTW/p1670526198358139?thread_ts=1670521809.442039&cid=C02RQBWTW
 have recently started failing] on all core commits
 {{{
 There were 2 failures:

 1) Tests_HTTP_curl::test_multiple_location_headers
 Failed asserting that
 'http://api.wordpress.org/core/tests/1.0/redirection.php?multiple-
 location-headers=1&redirected=one' is of type "array".

 /var/www/tests/phpunit/tests/http/base.php:453
 phpvfscomposer:///var/www/vendor/phpunit/phpunit/phpunit:60

 2) Tests_HTTP_streams::test_multiple_location_headers
 Failed asserting that
 'http://api.wordpress.org/core/tests/1.0/redirection.php?multiple-
 location-headers=1&redirected=one' is of type "array".

 /var/www/tests/phpunit/tests/http/base.php:453
 phpvfscomposer:///var/www/vendor/phpunit/phpunit/phpunit:60
 }}}

 The tests send a request to
 http://api.wordpress.org/core/tests/1.0/redirection.php and try to verify
 that multiple redirects are handled correctly. Some history here:
 * [342/tests] added the initial tests.
 * [874/tests] switch to running the redirection script from
 api.wordpress.org.
 * [1329/tests] introduced the affected test.

 I don't see any recent core changes that could cause those failures. The
 first failure was on [54949]. It appears that something has changed on the
 dotorg side that could have affected this, might have to do with updating
 nginx to 1.23.2 around the time of the first failure.

 When running the tests locally, it looks like the redirection script no
 longer sends the second header it's supposed to send:
 {{{
 if ( ! isset( $_GET['redirected'] ) ) {
         header( "Location: $url?multiple-location-
 headers=1&redirected=one", false );
         header( "Location: $url?multiple-location-
 headers=1&redirected=two", false );
         exit;
 }
 }}}

 This assertion fails because the result is now a string with only the
 first redirect, not an array with both of them:
 {{{
 $this->assertIsArray( wp_remote_retrieve_header( $res, 'location' ) );
 ...
 Failed asserting that
 'http://api.wordpress.org/core/tests/1.0/redirection.php?multiple-
 location-headers=1&redirected=one' is of type "array".
 }}}

 I have confirmed that the redirection script returns multiple `Location`
 headers when run locally, but only one on api.wordpress.org. I suppose we
 can disable the affected test for now, but it will also fail on older
 branches, so the disabling will need to be backported all the way to 4.1.

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


More information about the wp-trac mailing list