fredia commented on code in PR #24667: URL: https://github.com/apache/flink/pull/24667#discussion_r1575787928
########## flink-runtime/src/test/java/org/apache/flink/runtime/asyncprocessing/AsyncExecutionControllerTest.java: ########## @@ -346,6 +337,63 @@ public void testSyncPoint() { recordContext2.release(); } + @Test + void testBufferTimeout() throws InterruptedException { + batchSize = 5; + timeout = 1000; + setup(); + Runnable userCode = () -> valueState.asyncValue(); + + // ------------ basic timeout ------------------- + for (int i = 0; i < batchSize - 1; i++) { + String record = String.format("key%d-r%d", i, i); + String key = String.format("key%d", batchSize + i); + RecordContext<String> recordContext = aec.buildContext(record, key); + aec.setCurrentContext(recordContext); + userCode.run(); + } + assertThat(aec.timeoutFlag.get()).isFalse(); + assertThat(aec.currentScheduledFuture.isDone()).isFalse(); + assertThat(aec.inFlightRecordNum.get()).isEqualTo(batchSize - 1); + assertThat(aec.stateRequestsBuffer.activeQueueSize()).isEqualTo(batchSize - 1); + assertThat(aec.stateRequestsBuffer.blockingQueueSize()).isEqualTo(0); + + Thread.sleep(timeout + 100); Review Comment: Thanks for the suggestion, removed `Thread.sleep` from `testBufferTimeout()` and `testBufferTimeoutSkip()`, used `ManuallyTriggeredScheduledExecutorService` as `ScheduledExecutor`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org