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


##########
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:
   This code will loop and judge by itself. 
   
   ```java
    await().pollDelay(5, TimeUnit.SECONDS)
                   .atMost(30, TimeUnit.SECONDS)
                   .pollInterval(100, TimeUnit.MILLISECONDS)
                   .untilAsserted(
   ```



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