Skip to content

Commit a01b6fc

Browse files
committed
Dispatcher unite test
1 parent 2eb41f7 commit a01b6fc

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/EventDispatcherTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,20 @@ public boolean isLastAttempt() {
289289
assertThat(retryInfo.isLastAttempt()).isEqualTo(true);
290290
}
291291

292+
@Test
293+
void setReScheduleToPostExecutionControlFromUpdateControl() {
294+
testCustomResource.addFinalizer(DEFAULT_FINALIZER);
295+
296+
when(controller.createOrUpdateResource(eq(testCustomResource), any()))
297+
.thenReturn(
298+
UpdateControl.updateStatusSubResource(testCustomResource).withReSchedule(1000l));
299+
300+
PostExecutionControl control = eventDispatcher.handleExecution(
301+
executionScopeWithCREvent(Watcher.Action.ADDED, testCustomResource));
302+
303+
assertThat(control.getReScheduleDelay().get()).isEqualTo(1000l);
304+
}
305+
292306
private void markForDeletion(CustomResource customResource) {
293307
customResource.getMetadata().setDeletionTimestamp("2019-8-10");
294308
}

0 commit comments

Comments
 (0)