spuru9 commented on code in PR #28404:
URL: https://github.com/apache/flink/pull/28404#discussion_r3423040314
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/testutils/RestoreTestBase.java:
##########
@@ -276,6 +282,30 @@ private void registerSinkObserver(
});
}
+ private void awaitExpectedResults(
+ final TableTestProgram program, final List<CompletableFuture<?>>
futures)
+ throws Exception {
+ try {
+ CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]))
+ .get(RESULT_AWAIT_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
+ } catch (TimeoutException e) {
+ final StringBuilder message = new StringBuilder();
+ message.append("Sink did not produce the expected results within ")
+ .append(RESULT_AWAIT_TIMEOUT_MILLIS)
+ .append("ms for program '")
Review Comment:
```suggestion
.append(" ms for program '")
```
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/testutils/RestoreTestBase.java:
##########
@@ -431,7 +461,7 @@ void testRestore(TableTestProgram program, Path planPath,
String savepointPath)
if (afterRestoreSource == AfterRestoreSource.INFINITE) {
final TableResult tableResult = compiledPlan.execute();
- CompletableFuture.allOf(futures.toArray(new
CompletableFuture[0])).get();
+ awaitExpectedResults(program, futures);
tableResult.getJobClient().get().cancel().get();
Review Comment:
```suggestion
try {
awaitExpectedResults(program, futures);
} finally {
tableResult.getJobClient().get().cancel().get();
}
```
When awaitExpectedResults throws on timeout, the next line -
`tableResult.getJobClient().get().cancel().get()` — is skipped, so the job
keeps running.
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/testutils/RestoreTestBase.java:
##########
@@ -276,6 +282,30 @@ private void registerSinkObserver(
});
}
+ private void awaitExpectedResults(
+ final TableTestProgram program, final List<CompletableFuture<?>>
futures)
+ throws Exception {
+ try {
+ CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]))
+ .get(RESULT_AWAIT_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
+ } catch (TimeoutException e) {
+ final StringBuilder message = new StringBuilder();
+ message.append("Sink did not produce the expected results within ")
+ .append(RESULT_AWAIT_TIMEOUT_MILLIS)
+ .append("ms for program '")
+ .append(program.id)
+ .append("'.");
+ for (SinkTestStep sinkTestStep : program.getSetupSinkTestSteps()) {
+ message.append(System.lineSeparator())
+ .append("Sink '")
+ .append(sinkTestStep.name)
+ .append("' actual results: ")
Review Comment:
Is there a way to log the expected as well? using
`getExpectedBeforeRestoreAsStrings() / getExpectedAfterRestoreAsStrings()`
probably
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]