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