zentol commented on a change in pull request #18419:
URL: https://github.com/apache/flink/pull/18419#discussion_r788634420



##########
File path: 
flink-tests/src/test/java/org/apache/flink/test/recovery/ClusterEntrypointITCase.java
##########
@@ -81,4 +87,45 @@ public void 
testWorkingDirectoryIsNotDeletedInCaseOfProcessFailure() throws Exce
             }
         }
     }
+
+    @Test
+    public void 
testNondeterministicWorkingDirectoryIsDeletedInCaseOfProcessFailure()
+            throws Exception {
+        final File workingDirBase = TEMPORARY_FOLDER.newFolder();
+
+        final Configuration configuration = new Configuration();
+        configuration.set(
+                ClusterOptions.PROCESS_WORKING_DIR_BASE, 
workingDirBase.getAbsolutePath());
+
+        final TestProcessBuilder.TestProcess jobManagerProcess =
+                new TestProcessBuilder(
+                                
DispatcherProcess.DispatcherProcessEntryPoint.class.getName())
+                        .addConfigAsMainClassArgs(configuration)
+                        .start();
+
+        boolean success = false;
+        try {
+            CommonTestUtils.waitUntilCondition(
+                    () -> 
Files.list(workingDirBase.toPath()).findAny().isPresent(),
+                    Deadline.fromNow(Duration.ofMinutes(1L)));
+
+            final File workingDirectory =
+                    Iterables.getOnlyElement(
+                                    Files.list(workingDirBase.toPath())

Review comment:
       same as above

##########
File path: 
flink-tests/src/test/java/org/apache/flink/test/recovery/ClusterEntrypointITCase.java
##########
@@ -81,4 +87,45 @@ public void 
testWorkingDirectoryIsNotDeletedInCaseOfProcessFailure() throws Exce
             }
         }
     }
+
+    @Test
+    public void 
testNondeterministicWorkingDirectoryIsDeletedInCaseOfProcessFailure()
+            throws Exception {
+        final File workingDirBase = TEMPORARY_FOLDER.newFolder();
+
+        final Configuration configuration = new Configuration();
+        configuration.set(
+                ClusterOptions.PROCESS_WORKING_DIR_BASE, 
workingDirBase.getAbsolutePath());
+
+        final TestProcessBuilder.TestProcess jobManagerProcess =
+                new TestProcessBuilder(
+                                
DispatcherProcess.DispatcherProcessEntryPoint.class.getName())
+                        .addConfigAsMainClassArgs(configuration)
+                        .start();
+
+        boolean success = false;
+        try {
+            CommonTestUtils.waitUntilCondition(
+                    () -> 
Files.list(workingDirBase.toPath()).findAny().isPresent(),

Review comment:
       The stream returned by Files.list needs to be closed.




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