exceptionfactory commented on code in PR #11867:
URL: https://github.com/apache/nifi/pull/11867#discussion_r4414318498
##########
nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/scheduling/CronSchedulingAgentTest.java:
##########
@@ -150,4 +155,20 @@ void
testDoScheduleReportingTaskNodeCronExpressionInvalid() {
assertThrows(IllegalStateException.class, () ->
schedulingAgent.doSchedule(reportingTaskNode, lifecycleState));
}
+
+ @Test
+ void testNextScheduleAcrossAutumnDaylightSavingTransition() {
+ final ZoneId zone = ZoneId.of("Europe/Amsterdam");
+ final CronExpression cronExpression = CronExpression.parse("0 30 20 ?
* MON-FRI");
+
+ // Friday before the DST transition.
+ final ZonedDateTime currentSchedule = ZonedDateTime.of(2026, 10, 23,
20, 30, 0, 0, zone);
+
+ // Supply a fixed time rather than depending on the system clock.
+ final ZonedDateTime nextSchedule =
CronSchedulingAgent.getNextSchedule(currentSchedule, cronExpression,
currentSchedule);
+
+ assertEquals(LocalDateTime.of(2026, 10, 26, 20, 30),
nextSchedule.toLocalDateTime());
Review Comment:
Recommend declaring a local variable for `LocalDateTime` and reusing it
cross the the `currentSchedule` and assertions instead of repeated the year,
month, day values
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]