From e86943fd6429be96913db4b61363faa66e95508c Mon Sep 17 00:00:00 2001 From: Konstantin V Shvachko Date: Wed, 7 Jan 2015 16:03:11 -0800 Subject: [PATCH] HDFS-7561. TestFetchImage should write fetched-image-dir under target. Contributed by Liang Xie. --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../test/java/org/apache/hadoop/hdfs/TestFetchImage.java | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index a76f2a8544a..a8966df15c1 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -647,6 +647,9 @@ Release 2.7.0 - UNRELEASED HDFS-7564. NFS gateway dynamically reload UID/GID mapping file /etc/nfs.map (Yongjun Zhang via brandonli) + HDFS-7561. TestFetchImage should write fetched-image-dir under target. + (Liang Xie via shv) + Release 2.6.1 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestFetchImage.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestFetchImage.java index a8c6779b733..0d4435779aa 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestFetchImage.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestFetchImage.java @@ -26,20 +26,27 @@ import java.util.regex.Pattern; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.FileUtil; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.protocol.HdfsConstants.SafeModeAction; import org.apache.hadoop.hdfs.tools.DFSAdmin; import org.apache.hadoop.hdfs.util.MD5FileUtils; import org.apache.hadoop.io.MD5Hash; +import org.junit.AfterClass; import org.junit.Test; public class TestFetchImage { private static final File FETCHED_IMAGE_FILE = new File( - System.getProperty("build.test.dir"), "fetched-image-dir"); + System.getProperty("test.build.dir"), "target/fetched-image-dir"); // Shamelessly stolen from NNStorage. private static final Pattern IMAGE_REGEX = Pattern.compile("fsimage_(\\d+)"); + @AfterClass + public static void cleanup() { + FileUtil.fullyDelete(FETCHED_IMAGE_FILE); + } + /** * Download a few fsimages using `hdfs dfsadmin -fetchImage ...' and verify * the results.