Skip to content

Commit 713afae

Browse files
committed
Accommodate next execution time being unknown
A task's next execution time is unknown if, for example, it's currently running. When it's unknown the nextExecution.time will be missing from the json describing the task. This commit updates the documentation test to accommodate this possibility. Closes gh-42351
1 parent c1bd5bd commit 713afae

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/ScheduledTasksEndpointDocumentationTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,15 @@ void scheduledTasks() {
6363
fieldWithPath("cron.[].expression").description("Cron expression."),
6464
fieldWithPath("fixedDelay").description("Fixed delay tasks, if any."),
6565
targetFieldWithPrefix("fixedDelay.[]."), initialDelayWithPrefix("fixedDelay.[]."),
66-
nextExecutionWithPrefix("fixedDelay.[].")
67-
.description("Time of the next scheduled execution."),
66+
nextExecutionWithPrefix("fixedDelay.[]."),
6867
fieldWithPath("fixedDelay.[].interval")
6968
.description("Interval, in milliseconds, between the end of the last"
7069
+ " execution and the start of the next."),
7170
fieldWithPath("fixedRate").description("Fixed rate tasks, if any."),
7271
targetFieldWithPrefix("fixedRate.[]."),
7372
fieldWithPath("fixedRate.[].interval")
7473
.description("Interval, in milliseconds, between the start of each execution."),
75-
initialDelayWithPrefix("fixedRate.[]."),
76-
nextExecutionWithPrefix("fixedRate.[].")
77-
.description("Time of the next scheduled execution."),
74+
initialDelayWithPrefix("fixedRate.[]."), nextExecutionWithPrefix("fixedRate.[]."),
7875
fieldWithPath("custom").description("Tasks with custom triggers, if any."),
7976
targetFieldWithPrefix("custom.[]."),
8077
fieldWithPath("custom.[].trigger").description("Trigger for the task."))
@@ -93,7 +90,10 @@ private FieldDescriptor initialDelayWithPrefix(String prefix) {
9390
}
9491

9592
private FieldDescriptor nextExecutionWithPrefix(String prefix) {
96-
return fieldWithPath(prefix + "nextExecution.time").description("Time of the next scheduled execution.");
93+
return fieldWithPath(prefix + "nextExecution.time")
94+
.description("Time of the next scheduled execution, if known.")
95+
.type(JsonFieldType.STRING)
96+
.optional();
9797
}
9898

9999
private FieldDescriptor[] lastExecution() {

0 commit comments

Comments
 (0)