Make WordPress Core

Opened 6 months ago

Closed 6 months ago

#60288 closed defect (bug) (fixed)

Fix unstable query test for post tags

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


The Tests_Query_Results::test_query_tag__not_in() test is unstable and thus may occasionally fail, entirely random, see for example

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.

6 months ago

  • 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:

@boonebgorges commented on PR #5899:

6 months ago

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

@flixos90 commented on PR #5899:

6 months ago

Committed in - for some reason not properly showing up in SVN yet.

#4 @flixos90
6 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

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

Note: See TracTickets for help on using tickets.