diff --git a/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/EventProcessorTest.java b/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/EventProcessorTest.java index 6b7798d766..e1ff110421 100644 --- a/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/EventProcessorTest.java +++ b/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/EventProcessorTest.java @@ -116,7 +116,11 @@ void executesTheControllerInstantlyAfterErrorIfNewEventsReceived() { PostExecutionControl.exceptionDuringExecution(new RuntimeException("test")); when(reconciliationDispatcherMock.handleExecution(any())) - .thenReturn(postExecutionControl) + .thenAnswer((Answer) invocationOnMock -> { + // avoid to process the first event before the second submitted + Thread.sleep(50); + return postExecutionControl; + }) .thenReturn(PostExecutionControl.defaultDispatch()); // start processing an event