HDFS-11736. OIV tests should not write outside 'target' directory. Contributed by Yiqun Lin.
This commit is contained in:
parent
999c8fcbef
commit
315f07700d
|
@ -44,7 +44,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.io.Files;
|
|
||||||
import org.apache.commons.cli.ParseException;
|
import org.apache.commons.cli.ParseException;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
@ -2436,7 +2435,8 @@ public class TestCheckpoint {
|
||||||
public void testLegacyOivImage() throws Exception {
|
public void testLegacyOivImage() throws Exception {
|
||||||
MiniDFSCluster cluster = null;
|
MiniDFSCluster cluster = null;
|
||||||
SecondaryNameNode secondary = null;
|
SecondaryNameNode secondary = null;
|
||||||
File tmpDir = Files.createTempDir();
|
File tmpDir = GenericTestUtils.getTestDir("testLegacyOivImage");
|
||||||
|
tmpDir.mkdirs();
|
||||||
Configuration conf = new HdfsConfiguration();
|
Configuration conf = new HdfsConfiguration();
|
||||||
conf.set(DFSConfigKeys.DFS_NAMENODE_LEGACY_OIV_IMAGE_DIR_KEY,
|
conf.set(DFSConfigKeys.DFS_NAMENODE_LEGACY_OIV_IMAGE_DIR_KEY,
|
||||||
tmpDir.getAbsolutePath());
|
tmpDir.getAbsolutePath());
|
||||||
|
|
|
@ -21,7 +21,6 @@ import com.google.common.base.Supplier;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.io.Files;
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
|
@ -122,7 +121,8 @@ public class TestStandbyCheckpoints {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Configuration setupCommonConfig() {
|
protected Configuration setupCommonConfig() {
|
||||||
tmpOivImgDir = Files.createTempDir();
|
tmpOivImgDir = GenericTestUtils.getTestDir("TestStandbyCheckpoints");
|
||||||
|
tmpOivImgDir.mkdirs();
|
||||||
|
|
||||||
Configuration conf = new Configuration();
|
Configuration conf = new Configuration();
|
||||||
conf.setInt(DFSConfigKeys.DFS_NAMENODE_CHECKPOINT_CHECK_PERIOD_KEY, 1);
|
conf.setInt(DFSConfigKeys.DFS_NAMENODE_CHECKPOINT_CHECK_PERIOD_KEY, 1);
|
||||||
|
@ -144,6 +144,10 @@ public class TestStandbyCheckpoints {
|
||||||
cluster.shutdown();
|
cluster.shutdown();
|
||||||
cluster = null;
|
cluster = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tmpOivImgDir != null) {
|
||||||
|
FileUtil.fullyDelete(tmpOivImgDir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeout = 300000)
|
@Test(timeout = 300000)
|
||||||
|
|
|
@ -57,8 +57,6 @@ import javax.xml.parsers.ParserConfigurationException;
|
||||||
import javax.xml.parsers.SAXParser;
|
import javax.xml.parsers.SAXParser;
|
||||||
import javax.xml.parsers.SAXParserFactory;
|
import javax.xml.parsers.SAXParserFactory;
|
||||||
|
|
||||||
import com.google.common.io.Files;
|
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.output.NullOutputStream;
|
import org.apache.commons.io.output.NullOutputStream;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -120,7 +118,10 @@ public class TestOfflineImageViewer {
|
||||||
// multiple tests.
|
// multiple tests.
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void createOriginalFSImage() throws IOException {
|
public static void createOriginalFSImage() throws IOException {
|
||||||
tempDir = Files.createTempDir();
|
File[] nnDirs = MiniDFSCluster.getNameNodeDirectory(
|
||||||
|
MiniDFSCluster.getBaseDirectory(), 0, 0);
|
||||||
|
tempDir = nnDirs[0];
|
||||||
|
|
||||||
MiniDFSCluster cluster = null;
|
MiniDFSCluster cluster = null;
|
||||||
try {
|
try {
|
||||||
final ErasureCodingPolicy ecPolicy = SystemErasureCodingPolicies
|
final ErasureCodingPolicy ecPolicy = SystemErasureCodingPolicies
|
||||||
|
|
Loading…
Reference in New Issue