@@ -390,6 +390,8 @@ void newResourceAfterMissedDeleteEvent() {
390
390
391
391
@ Test
392
392
void rateLimitsReconciliationSubmission () {
393
+ when (reconciliationDispatcherMock .handleExecution (any ()))
394
+ .thenReturn (PostExecutionControl .defaultDispatch ());
393
395
// the refresh defaultPollingPeriod value does not matter here
394
396
var refreshPeriod = Duration .ofMillis (100 );
395
397
var event = prepareCREvent ();
@@ -403,10 +405,12 @@ void rateLimitsReconciliationSubmission() {
403
405
eventProcessor .handleEvent (event );
404
406
verify (reconciliationDispatcherMock , after (FAKE_CONTROLLER_EXECUTION_DURATION ).times (1 ))
405
407
.handleExecution (any ());
406
- verify (retryTimerEventSourceMock , times (0 )).scheduleOnce ((ResourceID ) any (), anyLong ());
408
+ verify (retryTimerEventSourceMock , times (0 ))
409
+ .scheduleOnce ((ResourceID ) any (), eq (refreshPeriod .toMillis ()));
407
410
408
411
eventProcessor .handleEvent (event );
409
- verify (retryTimerEventSourceMock , times (1 )).scheduleOnce ((ResourceID ) any (), anyLong ());
412
+ verify (retryTimerEventSourceMock , times (1 ))
413
+ .scheduleOnce ((ResourceID ) any (), eq (refreshPeriod .toMillis ()));
410
414
}
411
415
412
416
@ Test
@@ -662,6 +666,45 @@ void afterRetryExhaustedAdditionalEventTriggerReconciliationWhenDeleteEventPrese
662
666
verify (reconciliationDispatcherMock , times (4 )).handleExecution (any ());
663
667
}
664
668
669
+ @ Test
670
+ void rateLimitsDeleteEventInAllEventMode () {
671
+ when (eventSourceManagerMock .retryEventSource ()).thenReturn (retryTimerEventSourceMock );
672
+ when (reconciliationDispatcherMock .handleExecution (any ()))
673
+ .thenReturn (PostExecutionControl .defaultDispatch ());
674
+ eventProcessor =
675
+ spy (
676
+ new EventProcessor (
677
+ controllerConfigTriggerAllEvent (
678
+ GenericRetry .defaultLimitedExponentialRetry ()
679
+ .setInitialInterval (100 )
680
+ .setIntervalMultiplier (1 )
681
+ .setMaxAttempts (1 ),
682
+ rateLimiterMock ),
683
+ reconciliationDispatcherMock ,
684
+ eventSourceManagerMock ,
685
+ null ));
686
+ eventProcessor .start ();
687
+ // the refresh defaultPollingPeriod value does not matter here
688
+ var refreshPeriod = Duration .ofMillis (100 );
689
+ var event = prepareCREvent ();
690
+
691
+ final var rateLimit = new RateLimitState () {};
692
+ when (rateLimiterMock .initState ()).thenReturn (rateLimit );
693
+ when (rateLimiterMock .isLimited (rateLimit ))
694
+ .thenReturn (Optional .empty ())
695
+ .thenReturn (Optional .of (refreshPeriod ));
696
+
697
+ eventProcessor .handleEvent (event );
698
+ verify (reconciliationDispatcherMock , after (FAKE_CONTROLLER_EXECUTION_DURATION ).times (1 ))
699
+ .handleExecution (any ());
700
+ verify (retryTimerEventSourceMock , times (0 ))
701
+ .scheduleOnce ((ResourceID ) any (), eq (refreshPeriod .toMillis ()));
702
+
703
+ eventProcessor .handleEvent (event );
704
+ verify (retryTimerEventSourceMock , times (1 ))
705
+ .scheduleOnce ((ResourceID ) any (), eq (refreshPeriod .toMillis ()));
706
+ }
707
+
665
708
@ Test
666
709
void passesResourceFromStateToDispatcher () {
667
710
eventProcessor =
0 commit comments