Opened 14 months ago
Closed 14 months ago
#60288 closed defect (bug) (fixed)
Fix unstable query test for post tags
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch has-unit-tests |
Focuses: | Cc: |
Description
The Tests_Query_Results::test_query_tag__not_in()
test is unstable and thus may occasionally fail, entirely random, see for example https://github.com/WordPress/wordpress-develop/actions/runs/7573278489/job/20625142895?pr=5658.
This is because two of the posts that are generated have the exact same date and time and thus their order in the query result is random.
For the same reason, the other test methods test_query_paged()
and test_query_paged_and_posts_per_page()
in the same class are unstable as well.
An easy fix for this is to use unique dates.
It looks like this goes back to the almost 10 year old commit [30276]. :)
Change History (4)
This ticket was mentioned in PR #5899 on WordPress/wordpress-develop by @flixos90.
14 months ago
#1
- Keywords has-patch has-unit-tests added; needs-patch removed
@boonebgorges commented on PR #5899:
14 months ago
#2
Change looks good to me. Sorry for the trouble :-D
@flixos90 commented on PR #5899:
14 months ago
#3
Committed in https://core.trac.wordpress.org/changeset/57308 - for some reason not properly showing up in SVN yet.
This PR ensures the post dates are distinct, to avoid randomness in the results order.
With this, the
many-trackbacks
andno-comments
test posts no longer use the same date.Trac ticket: https://core.trac.wordpress.org/ticket/60288