You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/01/20 10:42:21 UTC

[GitHub] [flink] zentol commented on a change in pull request #18419: [FLINK-25709] Always delete non-deterministic working directories

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: issues-unsubscribe@flink.apache.org

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