HDFS-13336. Test cases of TestWriteToReplica failed in windows. Contributed by Xiao Liang.

This commit is contained in:
Inigo Goiri 2018-04-23 19:12:16 -07:00
parent 9b5375e0c1
commit df92a17e02
1 changed files with 13 additions and 6 deletions

View File

@ -21,6 +21,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
import java.util.ArrayList; import java.util.ArrayList;
@ -64,7 +65,8 @@ public class TestWriteToReplica {
// test close // test close
@Test @Test
public void testClose() throws Exception { public void testClose() throws Exception {
MiniDFSCluster cluster = new MiniDFSCluster.Builder(new HdfsConfiguration()).build(); MiniDFSCluster cluster = new MiniDFSCluster.Builder(new HdfsConfiguration(),
new File(GenericTestUtils.getRandomizedTempPath())).build();
try { try {
cluster.waitActive(); cluster.waitActive();
@ -86,7 +88,8 @@ public class TestWriteToReplica {
// test append // test append
@Test @Test
public void testAppend() throws Exception { public void testAppend() throws Exception {
MiniDFSCluster cluster = new MiniDFSCluster.Builder(new HdfsConfiguration()).build(); MiniDFSCluster cluster = new MiniDFSCluster.Builder(new HdfsConfiguration(),
new File(GenericTestUtils.getRandomizedTempPath())).build();
try { try {
cluster.waitActive(); cluster.waitActive();
DataNode dn = cluster.getDataNodes().get(0); DataNode dn = cluster.getDataNodes().get(0);
@ -106,7 +109,8 @@ public class TestWriteToReplica {
// test writeToRbw // test writeToRbw
@Test @Test
public void testWriteToRbw() throws Exception { public void testWriteToRbw() throws Exception {
MiniDFSCluster cluster = new MiniDFSCluster.Builder(new HdfsConfiguration()).build(); MiniDFSCluster cluster = new MiniDFSCluster.Builder(new HdfsConfiguration(),
new File(GenericTestUtils.getRandomizedTempPath())).build();
try { try {
cluster.waitActive(); cluster.waitActive();
DataNode dn = cluster.getDataNodes().get(0); DataNode dn = cluster.getDataNodes().get(0);
@ -126,7 +130,8 @@ public class TestWriteToReplica {
// test writeToTemporary // test writeToTemporary
@Test @Test
public void testWriteToTemporary() throws Exception { public void testWriteToTemporary() throws Exception {
MiniDFSCluster cluster = new MiniDFSCluster.Builder(new HdfsConfiguration()).build(); MiniDFSCluster cluster = new MiniDFSCluster.Builder(new HdfsConfiguration(),
new File(GenericTestUtils.getRandomizedTempPath())).build();
try { try {
cluster.waitActive(); cluster.waitActive();
DataNode dn = cluster.getDataNodes().get(0); DataNode dn = cluster.getDataNodes().get(0);
@ -512,7 +517,8 @@ public class TestWriteToReplica {
@Test @Test
public void testReplicaMapAfterDatanodeRestart() throws Exception { public void testReplicaMapAfterDatanodeRestart() throws Exception {
Configuration conf = new HdfsConfiguration(); Configuration conf = new HdfsConfiguration();
MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf) MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf,
new File(GenericTestUtils.getRandomizedTempPath()))
.nnTopology(MiniDFSNNTopology.simpleFederatedTopology(2)) .nnTopology(MiniDFSNNTopology.simpleFederatedTopology(2))
.build(); .build();
try { try {
@ -566,7 +572,8 @@ public class TestWriteToReplica {
@Test @Test
public void testRecoverInconsistentRbw() throws IOException { public void testRecoverInconsistentRbw() throws IOException {
Configuration conf = new HdfsConfiguration(); Configuration conf = new HdfsConfiguration();
MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).build(); MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf,
new File(GenericTestUtils.getRandomizedTempPath())).build();
cluster.waitActive(); cluster.waitActive();
DataNode dn = cluster.getDataNodes().get(0); DataNode dn = cluster.getDataNodes().get(0);
FsDatasetImpl fsDataset = (FsDatasetImpl)DataNodeTestUtils.getFSDataset(dn); FsDatasetImpl fsDataset = (FsDatasetImpl)DataNodeTestUtils.getFSDataset(dn);