This issue has been created
There are 6 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-118b9691-21e7-42d2-af04-f05ff1471130 XWIKI-24761 Closed

CommentsIT#commentsAreOrderedByDate fails when the test runner's timezone is not UTC

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-ca1b3134-0cf6-495a-ba5d-a5f8fbfceba2 Vincent Massol created this issue on 31/Aug/26 14:47
 
Summary: CommentsIT#commentsAreOrderedByDate fails when the test runner's timezone is not UTC
Issue Type: cid:jira-generated-image-avatar-118b9691-21e7-42d2-af04-f05ff1471130 Bug
Affects Versions: 16.4.8
Assignee: Unassigned
Components: Development Issues only
Created: 31/Aug/26 14:47
Priority: cid:jira-generated-image-static-major-ed7c4127-af04-4bd5-b6cd-772e92f49722 Major
Reporter: Vincent Massol
Description:

Problem

CommentsIT#commentsAreOrderedByDate (in xwiki-platform-flamingo-skin-test-docker) fails on any machine whose default timezone is not UTC. On a Europe/Paris host every date assertion is off by one hour:

expected: <1970/01/01 00:00> but was: <1970/01/01 01:00>

Both parameterized cases (English and French date format) fail.

The CI agents run in UTC, so the offset is zero there and the test passes. The failure is thus invisible to CI by construction and only ever hits developers running the test locally.

Cause

The test creates its XWiki.XWikiComments objects over REST, formatting each date property with:

private static final SimpleDateFormat DEFAULT_DATE_FORMAT = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
...
return DEFAULT_DATE_FORMAT.format(new Date(seconds * 1000L));

That formatter has no timezone set, so it formats in the test runner's default timezone: getDateString(24) produces 01/01/1970 01:00:24 on a Europe/Paris host instead of 01/01/1970 00:00:24.

The server then parses that string in DateClass.fromString(), which also sets no timezone and therefore parses in the server's timezone (UTC in the test container). Since the test sets the wiki timezone preference to UTC, the comment dates are displayed in UTC and the assertions expect UTC. The displayed dates are therefore shifted by the test runner's UTC offset.

The wiki timezone preference is correctly applied to the display. Only the input side of the test is wrong.

Fix

Format the dates sent to the server in UTC, by replacing the host-zone SimpleDateFormat with a DateTimeFormatter pinned to ZoneOffset.UTC.

Verified: both parameterized cases pass on a Europe/Paris host with the fix, and fail without it.

 
 

6 updates

 
cid:jira-generated-image-avatar-ca1b3134-0cf6-495a-ba5d-a5f8fbfceba2 Changes by Vincent Massol on 31/Aug/26 14:47
 
Fix Version: 18.8.0-rc-1
Documentation in Release Notes: N/A
Documentation: N/A
Assignee: Vincent Massol
Resolution: Fixed
Status: Open Closed