Skip to content

Commit a7b819b

Browse files
authored
fix: flaky unit tests (#1253)
1 parent f15f948 commit a7b819b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ void executesTheControllerInstantlyAfterErrorIfNewEventsReceived() {
116116
PostExecutionControl.exceptionDuringExecution(new RuntimeException("test"));
117117

118118
when(reconciliationDispatcherMock.handleExecution(any()))
119-
.thenReturn(postExecutionControl)
119+
.thenAnswer((Answer<PostExecutionControl>) invocationOnMock -> {
120+
// avoid to process the first event before the second submitted
121+
Thread.sleep(50);
122+
return postExecutionControl;
123+
})
120124
.thenReturn(PostExecutionControl.defaultDispatch());
121125

122126
// start processing an event

0 commit comments

Comments
 (0)