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

hexiaoqiao pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new ad443241932 YARN-11894. Fix test root directory conflict about 
TestLogInfo. (#8083). Contributed by Paco Chan.
ad443241932 is described below

commit ad443241932451ca241113af3dd294c9edaeec25
Author: Beako <[email protected]>
AuthorDate: Fri Feb 13 02:55:32 2026 -0600

    YARN-11894. Fix test root directory conflict about TestLogInfo. (#8083). 
Contributed by Paco Chan.
    
    Signed-off-by: He Xiaoqiao <[email protected]>
---
 .../hadoop/yarn/server/timeline/TestLogInfo.java       | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/src/test/java/org/apache/hadoop/yarn/server/timeline/TestLogInfo.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/src/test/java/org/apache/hadoop/yarn/server/timeline/TestLogInfo.java
index 6a4527c13c9..b6ddda11d34 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/src/test/java/org/apache/hadoop/yarn/server/timeline/TestLogInfo.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/src/test/java/org/apache/hadoop/yarn/server/timeline/TestLogInfo.java
@@ -77,6 +77,7 @@ public class TestLogInfo {
 
   @BeforeEach
   public void setup() throws Exception {
+    prepareCleanTestRootDir();
     config.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, TEST_ROOT_DIR.toString());
     HdfsConfiguration hdfsConfig = new HdfsConfiguration();
     hdfsCluster = new 
MiniDFSCluster.Builder(hdfsConfig).numDataNodes(1).build();
@@ -106,7 +107,24 @@ public void tearDown() throws Exception {
     jsonGenerator.close();
     outStream.close();
     outStreamDomain.close();
+
+    FileSystem hdfsFs = hdfsCluster.getFileSystem();
+    if (hdfsFs.exists(TEST_ROOT_DIR)) {
+      hdfsFs.delete(TEST_ROOT_DIR, true);
+    }
     hdfsCluster.shutdown();
+
+    FileSystem localFs = FileSystem.getLocal(config);
+    if (localFs.exists(TEST_ROOT_DIR)) {
+        localFs.delete(TEST_ROOT_DIR, true);
+    }
+  }
+  /**
+   * Creates a fresh test root directory after cleanup.
+   */
+  private void prepareCleanTestRootDir() throws IOException {
+      FileSystem localFs = FileSystem.getLocal(config);
+      localFs.mkdirs(TEST_ROOT_DIR);
   }
 
   @Test


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to