openinx commented on a change in pull request #10106: [FLINK-11463][e2e] Design 
the e2e java framework so that at least the Kafka streaming tests can run on it
URL: https://github.com/apache/flink/pull/10106#discussion_r344042493
 
 

 ##########
 File path: 
flink-end-to-end-tests/flink-end-to-end-tests-common/src/main/java/org/apache/flink/tests/util/FlinkDistribution.java
 ##########
 @@ -123,20 +126,28 @@ public void afterTestSuccess() {
 
        @Override
        public void afterTestFailure() {
-               logBackupDir.ifPresent(backupLocation -> {
+               if (logBackupDir != null) {
                        final UUID id = UUID.randomUUID();
-                       LOG.info("Backing up logs to {}/{}.", backupLocation, 
id);
+                       LOG.info("Backing up logs to {}/{}.", logBackupDir, id);
                        try {
-                               Files.createDirectories(backupLocation);
-                               FileUtils.copyDirectory(log.toFile(), 
backupLocation.resolve(id.toString()).toFile());
+                               Files.createDirectories(logBackupDir);
+                               FileUtils.copyDirectory(log.toFile(), 
logBackupDir.resolve(id.toString()).toFile());
                        } catch (IOException e) {
                                LOG.warn("An error occurred while backing up 
logs.", e);
                        }
-               });
-
+               }
                afterTestSuccess();
        }
 
+       /**
+        * Read the value of `rest.port` part in 
FLINK_DIST_DIR/conf/flink-conf.yaml.
+        *
+        * @return the rest port which standalone Flink cluster will listen.
+        */
+       public int getRestPort() {
+               return defaultConfig.getInteger("rest.port", 8081);
 
 Review comment:
   Well, thanks for your careful explantation, really helpful. 
   For the long-term solution,   if use the random port, then we can only write 
a small method to sweep the ports to detect which one is the rest.port ?  Or  
the MiniCluster need to pre-check the port one by one, if available then choose 
to be its rest.port and bind & listen ( As far as I know , the HBase mini 
cluster is using this way) , and after that the minicluster write the port into 
flink-config.yaml  ...  seems the second way will be better  I mean.. 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to