#51109 closed defect (bug) (fixed)
Random term meta test failures
Reported by: | SergeyBiryukov | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | |
Focuses: | Cc: |
Description
There is a recent race condition in the tests, causing random failures:
https://travis-ci.com/github/WordPress/wordpress-develop/builds/180906200
https://travis-ci.com/github/WordPress/wordpress-develop/builds/180910443
There was 1 failure: 1) Tests_Term_Meta::test_term_meta_should_be_lazy_loaded_for_all_terms_in_wp_query_loop Failed asserting that 201618 is identical to 201619. /var/www/tests/phpunit/tests/term/meta.php:155
Could be a coincidence, but [48840] seems to be the only recent commit dealing with terms, so might be related.
Change History (2)
Note: See
TracTickets for help on using
tickets.
If looks like [48840] is not the culprit per se, it just uncovered the fact that the failing test was fragile in the first place.
Specifically, the test ensures that metadata for an orphan term is not lazy loaded, because it's not attached to any posts. However, but the time the test runs, the
WP_Metadata_Lazyloader
queue contains quite a few IDs from previous tests, one of which can coincide with the orphan term ID from this test. When that happens, the term meta is retrieved from the cache and not from the database, as the test attempts to verify.Clearing the lazyloader queue at the beginning of the test appears to resolve the issue.