You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "LadyForest (via GitHub)" <gi...@apache.org> on 2023/02/02 04:36:27 UTC

[GitHub] [flink] LadyForest commented on a diff in pull request #21802: [FLINK-30811][sql-gateway] Fix SqlGateway cannot stop job correctly

LadyForest commented on code in PR #21802:
URL: https://github.com/apache/flink/pull/21802#discussion_r1094004423


##########
flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/gateway/local/ExecutorImplITCase.java:
##########
@@ -481,17 +489,35 @@ void testStopJob() throws Exception {
 
             // wait till the job turns into running status or the test times out
             TestUtils.waitUntilAllTasksAreRunning(clusterClient, jobID);
-            StringData savepointPath =
-                    CollectionUtil.iteratorToList(
-                                    executor.executeStatement(
-                                            String.format("STOP JOB '%s' WITH SAVEPOINT", jobID)))
-                            .get(0)
-                            .getString(0);
-            assertThat(savepointPath)
-                    .isNotNull()
-                    .matches(
-                            stringData ->
-                                    Files.exists(Paths.get(URI.create(stringData.toString()))));
+            String stopJobCmd =
+                    String.format("STOP JOB '%s'%s", jobID, withSavepoint ? " WITH SAVEPOINT" : "");
+            ClientResult stopResult = executor.executeStatement(stopJobCmd);
+            JobStatus expectedJobStatus;
+            if (withSavepoint) {
+                String savepointPath =
+                        CollectionUtil.iteratorToList(stopResult).get(0).getString(0).toString();
+
+                assertThat(savepointPath)
+                        .matches(path -> Files.exists(Paths.get(URI.create(path))));
+                expectedJobStatus = JobStatus.FINISHED;
+            } else {
+                TestUtils.waitUntilJobCanceled(jobID, clusterClient);

Review Comment:
   Good point, this can be removed after the fix



-- 
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