liucongjy commented on code in PR #9951:
URL: https://github.com/apache/seatunnel/pull/9951#discussion_r2612822710


##########
seatunnel-engine/seatunnel-engine-server/src/test/java/org/apache/seatunnel/engine/server/rest/RestApiHttpsTest.java:
##########
@@ -126,4 +136,245 @@ public void testRestApiHttpsFailed() {
                     conn.getResponseCode();
                 });
     }
+
+    @Test
+    public void testFinishedJobsApi() throws Exception {
+        JobInformation jobInformation = getSeatunnelServer("testFinishedJobs");
+        int jobNum = 7;
+        int pageSize = 5;
+        long jobId = 1000L;
+        for (int i = 0; i < jobNum; i++) {
+            startJob(i + jobId, "fake_to_console.conf", jobInformation);
+        }
+
+        // wait until all jobs are finished
+        await().pollDelay(5, TimeUnit.SECONDS)
+                .atMost(30, TimeUnit.SECONDS)
+                .pollInterval(100, TimeUnit.MILLISECONDS)
+                .untilAsserted(
+                        () -> {
+                            while (jobInformation
+                                            .coordinatorService
+                                            .getJobCountMetrics()
+                                            .getFinishedJobCount()
+                                    != jobNum) {
+                                Thread.sleep(1000);
+                            }
+                        });

Review Comment:
   I have another question: after using `await().atMost(60, TimeUnit.SECONDS)`, 
when querying the total number of tasks in the "running" status via the API, 
could it be possible that some tasks have already transitioned to the 
"finished" state? This might cause the total number of tasks in the "running" 
status to not match the number of submitted tasks, leading to the failure of 
the `testRunningJobsApi` unit test. This scenario occasionally occurs in local 
testing. Can we remove the `testRunningJobsApi` unit test?



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

Reply via email to