This is an automated email from the ASF dual-hosted git repository.

kkloudas pushed a commit to branch release-1.10
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.10 by this push:
     new b17a597  [FLINK-13483] Retry delete when checking path existence in 
AbstractHadoopFileSystemITTest
b17a597 is described below

commit b17a597dec80e590db2beedda446aa3cae9920dd
Author: qqibrow <[email protected]>
AuthorDate: Wed Mar 25 16:39:13 2020 -0700

    [FLINK-13483] Retry delete when checking path existence in 
AbstractHadoopFileSystemITTest
---
 .../fs/hdfs/AbstractHadoopFileSystemITTest.java      | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git 
a/flink-filesystems/flink-hadoop-fs/src/test/java/org/apache/flink/runtime/fs/hdfs/AbstractHadoopFileSystemITTest.java
 
b/flink-filesystems/flink-hadoop-fs/src/test/java/org/apache/flink/runtime/fs/hdfs/AbstractHadoopFileSystemITTest.java
index d2695d7..083a880 100644
--- 
a/flink-filesystems/flink-hadoop-fs/src/test/java/org/apache/flink/runtime/fs/hdfs/AbstractHadoopFileSystemITTest.java
+++ 
b/flink-filesystems/flink-hadoop-fs/src/test/java/org/apache/flink/runtime/fs/hdfs/AbstractHadoopFileSystemITTest.java
@@ -27,6 +27,7 @@ import org.apache.flink.core.fs.Path;
 import org.apache.flink.util.TestLogger;
 
 import org.junit.AfterClass;
+import org.junit.Assert;
 import org.junit.Test;
 
 import java.io.BufferedReader;
@@ -137,26 +138,27 @@ public abstract class AbstractHadoopFileSystemITTest 
extends TestLogger {
                }
                finally {
                        // clean up
-                       fs.delete(directory, true);
+                       cleanupDirectoryWithRetry(fs, directory, deadline);
                }
-
-               // now directory must be gone
-               checkPathExistence(directory, false, deadline);
        }
 
        @AfterClass
        public static void teardown() throws IOException, InterruptedException {
                try {
                        if (fs != null) {
-                               // clean up
-                               fs.delete(basePath, true);
-
-                               // now directory must be gone
-                               checkPathExistence(basePath, false, deadline);
+                               cleanupDirectoryWithRetry(fs, basePath, 
deadline);
                        }
                }
                finally {
                        FileSystem.initialize(new Configuration());
                }
        }
+
+       public static void cleanupDirectoryWithRetry(FileSystem fs, Path path, 
long deadline) throws IOException, InterruptedException {
+               while (fs.exists(path) && System.nanoTime() < deadline) {
+                       fs.delete(path, true);
+                       Thread.sleep(50L);
+               }
+               Assert.assertFalse(fs.exists(path));
+       }
 }

Reply via email to