tillrohrmann commented on a change in pull request #15825:
URL: https://github.com/apache/flink/pull/15825#discussion_r626338652



##########
File path: 
flink-tests/src/test/java/org/apache/flink/test/scheduling/ReactiveModeITCase.java
##########
@@ -265,10 +211,41 @@ public void run(SourceContext<String> ctx) throws 
Exception {
         public void cancel() {
             running = false;
         }
+    }
 
-        @Override
-        public void close() throws Exception {
-            tracker.reportStoppedInstance();
-        }
+    public static void waitUntilParallelismForVertexReached(
+            URI restAddress, JobID jobId, int targetParallelism) throws 
Exception {
+
+        final RestClient restClient =
+                new RestClient(
+                        RestClientConfiguration.fromConfiguration(new 
Configuration()),
+                        TestingUtils.defaultExecutor());
+
+        final JobDetailsHeaders detailsHeaders = 
JobDetailsHeaders.getInstance();
+        final JobMessageParameters params = 
detailsHeaders.getUnresolvedMessageParameters();
+        params.jobPathParameter.resolve(jobId);
+
+        CommonTestUtils.waitUntilCondition(
+                () -> {
+                    JobDetailsInfo detailsInfo =
+                            restClient
+                                    .sendRequest(
+                                            restAddress.getHost(),
+                                            restAddress.getPort(),
+                                            detailsHeaders,
+                                            params,
+                                            EmptyRequestBody.getInstance())
+                                    .get();
+
+                    for (JobDetailsInfo.JobVertexDetailsInfo jobVertexInfo :
+                            detailsInfo.getJobVertexInfos()) {
+                        if (jobVertexInfo.getName().contains("Source:")
+                                && jobVertexInfo.getParallelism() == 
targetParallelism) {
+                            return true;
+                        }
+                    }
+                    return false;
+                },
+                Deadline.fromNow(Duration.ofSeconds(10)));

Review comment:
       I am wondering whether we shouldn't enrich the `MiniClusterResource` to 
return a `RestClusterClient`. That way we wouldn't have to construct the 
request manually and could simply use `RestClusterClient.getJobDetails`.




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

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


Reply via email to