Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#60288 closed defect (bug) (fixed)

Fix unstable query test for post tags

Reported by: flixos90 Owned by: flixos90
Priority: normal Milestone: 6.5
Component: Build/Test Tools Version:
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses:

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.


3 years ago
#1

  • Keywords has-patch has-unit-tests added; needs-patch removed

This PR ensures the post dates are distinct, to avoid randomness in the results order.

With this, the many-trackbacks and no-comments test posts no longer use the same date.

Trac ticket: https://core.trac.wordpress.org/ticket/60288

​@boonebgorges commented on ​PR #5899:


3 years ago
#2

Change looks good to me. Sorry for the trouble :-D

​@flixos90 commented on ​PR #5899:


3 years ago
#3

Committed in https://core.trac.wordpress.org/changeset/57308 - for some reason not properly showing up in SVN yet.

#4 @flixos90
3 years ago

  • Resolution → fixed
  • Status assigned → closed

Fixed via [57308] (somehow not showing in SVN, but it's there).

Note: See TracTickets for help on using tickets.