@@ -598,10 +598,66 @@ void triggerOnAllEventRetriesDeleteEventError() {
598
598
}
599
599
600
600
@ Test
601
- void processesAdditionalEventWhileInDeleteModeRetry () {}
601
+ void processesAdditionalEventWhileInDeleteModeRetry () {
602
+ when (eventSourceManagerMock .retryEventSource ()).thenReturn (mock (TimerEventSource .class ));
603
+ eventProcessor =
604
+ spy (
605
+ new EventProcessor (
606
+ controllerConfigTriggerAllEvent (
607
+ GenericRetry .DEFAULT .setInitialInterval (1000 ).setMaxAttempts (-1 ),
608
+ rateLimiterMock ),
609
+ reconciliationDispatcherMock ,
610
+ eventSourceManagerMock ,
611
+ null ));
612
+ when (reconciliationDispatcherMock .handleExecution (any ()))
613
+ .thenReturn (PostExecutionControl .defaultDispatch ())
614
+ .thenReturn (PostExecutionControl .exceptionDuringExecution (new RuntimeException ()));
615
+
616
+ eventProcessor .start ();
617
+
618
+ eventProcessor .handleEvent (prepareCREvent1 ());
619
+ waitUntilProcessingFinished (eventProcessor , TestUtils .testCustomResource1Id ());
620
+ eventProcessor .handleEvent (prepareCRDeleteEvent1 ());
621
+ verify (reconciliationDispatcherMock , times (2 )).handleExecution (any ());
622
+ waitUntilProcessingFinished (eventProcessor , TestUtils .testCustomResource1Id ());
623
+ // retry event
624
+ eventProcessor .handleEvent (new Event (TestUtils .testCustomResource1Id ()));
625
+ waitUntilProcessingFinished (eventProcessor , TestUtils .testCustomResource1Id ());
626
+ verify (reconciliationDispatcherMock , times (3 )).handleExecution (any ());
627
+ }
602
628
603
629
@ Test
604
- void triggerOnAllEventIfNoRetryInCleanupOnError () {}
630
+ void afterRetryExhaustedAdditionalEventTriggerReconciliationWhenDeleteEventPresent () {
631
+ when (eventSourceManagerMock .retryEventSource ()).thenReturn (mock (TimerEventSource .class ));
632
+ eventProcessor =
633
+ spy (
634
+ new EventProcessor (
635
+ controllerConfigTriggerAllEvent (
636
+ GenericRetry .DEFAULT
637
+ .setInitialInterval (100 )
638
+ .setIntervalMultiplier (1 )
639
+ .setMaxAttempts (1 ),
640
+ rateLimiterMock ),
641
+ reconciliationDispatcherMock ,
642
+ eventSourceManagerMock ,
643
+ null ));
644
+ when (reconciliationDispatcherMock .handleExecution (any ()))
645
+ .thenReturn (PostExecutionControl .defaultDispatch ())
646
+ .thenReturn (PostExecutionControl .exceptionDuringExecution (new RuntimeException ()));
647
+ eventProcessor .start ();
648
+
649
+ eventProcessor .handleEvent (prepareCREvent1 ());
650
+ waitUntilProcessingFinished (eventProcessor , TestUtils .testCustomResource1Id ());
651
+ eventProcessor .handleEvent (prepareCRDeleteEvent1 ());
652
+ waitUntilProcessingFinished (eventProcessor , TestUtils .testCustomResource1Id ());
653
+ eventProcessor .handleEvent (new Event (TestUtils .testCustomResource1Id ()));
654
+ await ()
655
+ .untilAsserted (() -> verify (reconciliationDispatcherMock , times (3 )).handleExecution (any ()));
656
+
657
+ eventProcessor .handleEvent (new Event (TestUtils .testCustomResource1Id ()));
658
+ waitUntilProcessingFinished (eventProcessor , TestUtils .testCustomResource1Id ());
659
+ verify (reconciliationDispatcherMock , times (4 )).handleExecution (any ());
660
+ }
605
661
606
662
@ Test
607
663
void passesResourceFromStateToDispatcher () {
0 commit comments