Skip to content

Fix DST-flaky CronScheduleTest timezone test#4891

Merged
kgrgreer merged 2 commits intodevelopmentfrom
fix-tests-failing
Mar 9, 2026
Merged

Fix DST-flaky CronScheduleTest timezone test#4891
kgrgreer merged 2 commits intodevelopmentfrom
fix-tests-failing

Conversation

@abdelaziz-mahdy
Copy link
Collaborator

Problem

The CronScheduleTest timezone test was intermittently failing near DST transitions. The test scheduled a cron job at 2:00 AM America/Toronto, but during the spring-forward DST transition, 2:00 AM doesn't exist (clocks jump from 1:59 AM to 3:00 AM). Java's LocalDateTime.atZone() adjusts the non-existent time forward, causing the Calendar.HOUR_OF_DAY assertion to fail (expects 2, gets 3).

Solution

Changed the test hour from 2 to 10, which is unaffected by DST transitions (spring-forward and fall-back both occur at 2:00 AM). The test still validates the same timezone conversion logic — just with an hour that always exists.

Changes

  • CronScheduleTest.js: Changed timezone test hour from 2 to 10 to avoid DST spring-forward gap. Updated assertion from HOUR_OF_DAY == 2 to HOUR_OF_DAY == 10. Added comment explaining the DST avoidance rationale.

Hour 2 falls in the DST spring-forward gap (2 AM doesn't exist on
transition day in America/Toronto), causing intermittent test failure.
Use hour 10 which is unaffected by DST transitions.
@abdelaziz-mahdy
Copy link
Collaborator Author

#4892

@kgrgreer kgrgreer merged commit b3e4332 into development Mar 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants