You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "fredia (via GitHub)" <gi...@apache.org> on 2023/03/22 03:26:07 UTC

[GitHub] [flink] fredia commented on a diff in pull request #22234: [FLINK-31527][tests] Stabilize ChangelogRescalingITCase

fredia commented on code in PR #22234:
URL: https://github.com/apache/flink/pull/22234#discussion_r1144191958


##########
flink-tests/src/test/java/org/apache/flink/test/state/ChangelogRescalingITCase.java:
##########
@@ -329,24 +329,30 @@ public boolean request() {
     private String checkpointAndCancel(JobID jobID) throws Exception {
         waitForCheckpoint(jobID, cluster.getMiniCluster(), 1);
         cluster.getClusterClient().cancel(jobID).get();
-        checkStatus(jobID);
+        waitForSuccessfulTermination(jobID);
         return CommonTestUtils.getLatestCompletedCheckpointPath(jobID, cluster.getMiniCluster())
                 .<NoSuchElementException>orElseThrow(
                         () -> {
                             throw new NoSuchElementException("No checkpoint was created yet");
                         });
     }
 
-    private void checkStatus(JobID jobID) throws InterruptedException, ExecutionException {
-        if (cluster.getClusterClient().getJobStatus(jobID).get().isGloballyTerminalState()) {
-            cluster.getClusterClient()
-                    .requestJobResult(jobID)
-                    .get()
-                    .getSerializedThrowable()
-                    .ifPresent(
-                            serializedThrowable -> {
-                                throw new RuntimeException(serializedThrowable);
-                            });
+    private void waitForSuccessfulTermination(JobID jobID)
+            throws InterruptedException, ExecutionException {
+        while (true) {

Review Comment:
   Maybe we can use `CommonTestUtils.waitUntilCondition` instead of `while loop`.



-- 
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-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org