[wp-trac] [WordPress Trac] #48145: Random PHP 7.1 test failures

WordPress Trac noreply at wordpress.org
Sun Sep 29 13:23:23 UTC 2019


#48145: Random PHP 7.1 test failures
------------------------------+------------------------------
 Reporter:  SergeyBiryukov    |       Owner:  (none)
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  Awaiting Review
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:                    |     Focuses:
------------------------------+------------------------------
Description changed by SergeyBiryukov:

Old description:

> Every few commits, there's now a random PHP 7.1 test failure on Travis,
> mostly off-by-one errors unrelated to the preceding commit. Started about
> 1 month ago, after August 20th.
>
> Seems like either PHP 7.1 tests are for some reason more prone to random
> errors than other versions, or it's just more prominent now that random
> date/time failures from #45821 are fixed.
>
> Creating a ticket just for reference, any ideas as to why this happens
> appreciated.
>
> Some examples:
> {{{
> 1) WP_Test_REST_Posts_Controller::test_get_items_search_query
> Failed asserting that 6 matches expected 7.
> /var/www/tests/phpunit/tests/rest-api/rest-posts-controller.php:459
> }}}
> {{{
> 1) WP_Test_REST_Posts_Controller::test_get_items_pagination_headers
> Failed asserting that 49 matches expected 50.
> /var/www/tests/phpunit/tests/rest-api/rest-posts-controller.php:1157
> }}}
> {{{
> 1) Tests_Canonical_PageOnFront::test with data set #3 ('/?page=1', '/')
> Failed asserting that two strings are equal.
> --- Expected
> +++ Actual
> @@ @@
> -'/'
> +'/?page=1'
> /var/www/tests/phpunit/includes/testcase-canonical.php:268
> /var/www/tests/phpunit/tests/canonical/pageOnFront.php:39
> 2)
> Tests_Query_MetaQuery::test_meta_query_single_query_compare_arithmetic_comparisons
> Failed asserting that two arrays are equal.
> --- Expected
> +++ Actual
> @@ @@
>  Array (
> -    0 => 2319
>  )
> /var/www/tests/phpunit/includes/abstract-testcase.php:658
> /var/www/tests/phpunit/tests/query/metaQuery.php:162
> }}}
> {{{
> 1) Tests_Query::test_tag_querystring_single_term
> Failed asserting that two arrays are equal.
> --- Expected
> +++ Actual
> @@ @@
>  Array (
>      0 => 2022
> -    1 => 2023
>  )
> /var/www/tests/phpunit/includes/abstract-testcase.php:658
> /var/www/tests/phpunit/tests/query.php:321
> }}}
> {{{
> 1) Tests_Term_getTerms::test_wp_delete_term_should_invalidate_cache
> Failed asserting that 1 matches expected 2.
> /var/www/tests/phpunit/tests/term/getTerms.php:181
> }}}
> {{{
> 1) Tests_Query_VerbosePageRules::test_page_page_2
> is_404 is true but is expected to be false.
> is_page is false but is expected to be true.
> is_paged is false but is expected to be true.
> is_singular is false but is expected to be true.
> /var/www/tests/phpunit/includes/abstract-testcase.php:971
> /var/www/tests/phpunit/tests/query/conditionals.php:327
>
> 1) Tests_Query_MetaQuery::test_meta_query_decimal_results
> Failed asserting that two arrays are equal.
> --- Expected
> +++ Actual
> @@ @@
>  Array (
> -    0 => 2414
>  )
> /var/www/tests/phpunit/includes/abstract-testcase.php:658
> /var/www/tests/phpunit/tests/query/metaQuery.php:1170
> }}}
> {{{
> 1) Tests_Term_getTerms::test_hierarchical_true_with_parent
> Failed asserting that two arrays are equal.
> --- Expected
> +++ Actual
> @@ @@
>  Array (
> -    0 => 1277
> -    1 => 1280
> +    0 => 1280
>  )
> /var/www/tests/phpunit/includes/abstract-testcase.php:658
> /var/www/tests/phpunit/tests/term/getTerms.php:2257
> }}}
> {{{
> 1) Tests_Query_SetupPostdata::test_secondary_query_nextpage
> Failed asserting that two arrays are identical.
> --- Expected
> +++ Actual
> @@ @@
>  Array &0 (
> -    0 => 'Post 1 Page 1'
> -    1 => 'Post 1 Page 2'
> +    0 => 'Post 2 Page 1'
> +    1 => 'Post 2 Page 2'
>  )
> /var/www/tests/phpunit/tests/query/setupPostdata.php:249
> }}}
> {{{
> 1) Tests_Query_MetaQuery::test_meta_between_not_between
> Failed asserting that 1 matches expected 2.
> /var/www/tests/phpunit/tests/query/metaQuery.php:1537
> }}}
> {{{
> 1)
> Tests_Post_getPages::test_get_pages_non_hierarchical_non_empty_child_of
> Failed asserting that two arrays are equal.
> --- Expected
> +++ Actual
> @@ @@
>  Array (
>      0 => 1677
>      1 => 1678
> -    2 => 1679
>  )
> /var/www/tests/phpunit/includes/abstract-testcase.php:649
> /var/www/tests/phpunit/tests/post/getPages.php:617
> }}}
> {{{
> 1) Tests_Post_Query::test_orderby_post__in_array
> Failed asserting that two arrays are identical.
> --- Expected
> +++ Actual
> @@ @@
>  Array &0 (
> -    0 => 428
> -    1 => 426
> -    2 => 429
> +    0 => 426
> +    1 => 429
>  )
> /var/www/tests/phpunit/tests/post/query.php:192
> }}}

New description:

 Every few commits, there's now a random PHP 7.1 test failure on Travis,
 mostly off-by-one errors unrelated to the preceding commit. Started about
 1 month ago, after August 20th.

 Seems like either PHP 7.1 tests are for some reason more prone to random
 errors than other versions, or it's just more prominent now that random
 date/time failures from #45821 are fixed.

 Creating a ticket just for reference, any ideas as to why this happens
 appreciated.

 Some examples:
 {{{
 1) WP_Test_REST_Posts_Controller::test_get_items_search_query
 Failed asserting that 6 matches expected 7.
 /var/www/tests/phpunit/tests/rest-api/rest-posts-controller.php:459
 }}}
 {{{
 1) WP_Test_REST_Posts_Controller::test_get_items_pagination_headers
 Failed asserting that 49 matches expected 50.
 /var/www/tests/phpunit/tests/rest-api/rest-posts-controller.php:1157
 }}}
 {{{
 1) Tests_Canonical_PageOnFront::test with data set #3 ('/?page=1', '/')
 Failed asserting that two strings are equal.
 --- Expected
 +++ Actual
 @@ @@
 -'/'
 +'/?page=1'
 /var/www/tests/phpunit/includes/testcase-canonical.php:268
 /var/www/tests/phpunit/tests/canonical/pageOnFront.php:39

 2)
 Tests_Query_MetaQuery::test_meta_query_single_query_compare_arithmetic_comparisons
 Failed asserting that two arrays are equal.
 --- Expected
 +++ Actual
 @@ @@
  Array (
 -    0 => 2319
  )
 /var/www/tests/phpunit/includes/abstract-testcase.php:658
 /var/www/tests/phpunit/tests/query/metaQuery.php:162
 }}}
 {{{
 1) Tests_Query::test_tag_querystring_single_term
 Failed asserting that two arrays are equal.
 --- Expected
 +++ Actual
 @@ @@
  Array (
      0 => 2022
 -    1 => 2023
  )
 /var/www/tests/phpunit/includes/abstract-testcase.php:658
 /var/www/tests/phpunit/tests/query.php:321
 }}}
 {{{
 1) Tests_Term_getTerms::test_wp_delete_term_should_invalidate_cache
 Failed asserting that 1 matches expected 2.
 /var/www/tests/phpunit/tests/term/getTerms.php:181
 }}}
 {{{
 1) Tests_Query_VerbosePageRules::test_page_page_2
 is_404 is true but is expected to be false.
 is_page is false but is expected to be true.
 is_paged is false but is expected to be true.
 is_singular is false but is expected to be true.
 /var/www/tests/phpunit/includes/abstract-testcase.php:971
 /var/www/tests/phpunit/tests/query/conditionals.php:327

 1) Tests_Query_MetaQuery::test_meta_query_decimal_results
 Failed asserting that two arrays are equal.
 --- Expected
 +++ Actual
 @@ @@
  Array (
 -    0 => 2414
  )
 /var/www/tests/phpunit/includes/abstract-testcase.php:658
 /var/www/tests/phpunit/tests/query/metaQuery.php:1170
 }}}
 {{{
 1) Tests_Term_getTerms::test_hierarchical_true_with_parent
 Failed asserting that two arrays are equal.
 --- Expected
 +++ Actual
 @@ @@
  Array (
 -    0 => 1277
 -    1 => 1280
 +    0 => 1280
  )
 /var/www/tests/phpunit/includes/abstract-testcase.php:658
 /var/www/tests/phpunit/tests/term/getTerms.php:2257
 }}}
 {{{
 1) Tests_Query_SetupPostdata::test_secondary_query_nextpage
 Failed asserting that two arrays are identical.
 --- Expected
 +++ Actual
 @@ @@
  Array &0 (
 -    0 => 'Post 1 Page 1'
 -    1 => 'Post 1 Page 2'
 +    0 => 'Post 2 Page 1'
 +    1 => 'Post 2 Page 2'
  )
 /var/www/tests/phpunit/tests/query/setupPostdata.php:249
 }}}
 {{{
 1) Tests_Query_MetaQuery::test_meta_between_not_between
 Failed asserting that 1 matches expected 2.
 /var/www/tests/phpunit/tests/query/metaQuery.php:1537
 }}}
 {{{
 1) Tests_Post_getPages::test_get_pages_non_hierarchical_non_empty_child_of
 Failed asserting that two arrays are equal.
 --- Expected
 +++ Actual
 @@ @@
  Array (
      0 => 1677
      1 => 1678
 -    2 => 1679
  )
 /var/www/tests/phpunit/includes/abstract-testcase.php:649
 /var/www/tests/phpunit/tests/post/getPages.php:617
 }}}
 {{{
 1) Tests_Post_Query::test_orderby_post__in_array
 Failed asserting that two arrays are identical.
 --- Expected
 +++ Actual
 @@ @@
  Array &0 (
 -    0 => 428
 -    1 => 426
 -    2 => 429
 +    0 => 426
 +    1 => 429
  )
 /var/www/tests/phpunit/tests/post/query.php:192
 }}}
 {{{
 1) Tests_Get_Archives::test_wp_get_archives_limit
 Failed asserting that two strings are equal.
 --- Expected
 +++ Actual
 @@ @@
 -'<li><a href='http://example.org/?p=1143'>Post title 3347</a></li>\n
 -       <li><a href='http://example.org/?p=1142'>Post title
 3346</a></li>\n
 +'<li><a href='http://example.org/?p=1142'>Post title 3346</a></li>\n
         <li><a href='http://example.org/?p=1141'>Post title
 3345</a></li>\n
         <li><a href='http://example.org/?p=1140'>Post title
 3344</a></li>\n
 -       <li><a href='http://example.org/?p=1139'>Post title 3343</a></li>'
 +       <li><a href='http://example.org/?p=1139'>Post title
 3343</a></li>\n
 +       <li><a href='http://example.org/?p=1138'>Post title 3342</a></li>'
 /var/www/tests/phpunit/tests/functions/getArchives.php:79

 2) Tests_Get_Archives::test_wp_get_archives_show_post_count
 Failed asserting that two strings are equal.
 --- Expected
 +++ Actual
 @@ @@
 -'<li><a href='http://example.org/?m=201909'>September
 2019</a> (8)</li>'
 +'<li><a href='http://example.org/?m=201909'>September
 2019</a> (7)</li>'
 /var/www/tests/phpunit/tests/functions/getArchives.php:127
 }}}

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48145#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list