HDFS-8642. Make TestFileTruncate more reliable. (Contributed by Rakesh R)

This commit is contained in:
Arpit Agarwal 2015-07-08 09:31:02 -07:00
parent 98e59261b7
commit 4119ad3112
2 changed files with 9 additions and 12 deletions

View File

@ -1017,6 +1017,9 @@ Release 2.8.0 - UNRELEASED
HDFS-8686. WebHdfsFileSystem#getXAttr(Path p, final String name) doesn't HDFS-8686. WebHdfsFileSystem#getXAttr(Path p, final String name) doesn't
work if namespace is in capitals (kanaka kumar avvaru via vinayakumarb) work if namespace is in capitals (kanaka kumar avvaru via vinayakumarb)
HDFS-8642. Make TestFileTruncate more reliable. (Rakesh R via
Arpit Agarwal)
Release 2.7.2 - UNRELEASED Release 2.7.2 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -62,9 +62,8 @@
import org.apache.hadoop.util.Time; import org.apache.hadoop.util.Time;
import org.apache.hadoop.util.ToolRunner; import org.apache.hadoop.util.ToolRunner;
import org.apache.log4j.Level; import org.apache.log4j.Level;
import org.junit.AfterClass; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
public class TestFileTruncate { public class TestFileTruncate {
@ -90,8 +89,8 @@ public class TestFileTruncate {
private Path parent; private Path parent;
@BeforeClass @Before
public static void startUp() throws IOException { public void setUp() throws IOException {
conf = new HdfsConfiguration(); conf = new HdfsConfiguration();
conf.setLong(DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY, BLOCK_SIZE); conf.setLong(DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY, BLOCK_SIZE);
conf.setInt(DFSConfigKeys.DFS_BYTES_PER_CHECKSUM_KEY, BLOCK_SIZE); conf.setInt(DFSConfigKeys.DFS_BYTES_PER_CHECKSUM_KEY, BLOCK_SIZE);
@ -105,20 +104,15 @@ public static void startUp() throws IOException {
.waitSafeMode(true) .waitSafeMode(true)
.build(); .build();
fs = cluster.getFileSystem(); fs = cluster.getFileSystem();
parent = new Path("/test");
} }
@AfterClass @After
public static void tearDown() throws IOException { public void tearDown() throws IOException {
if(fs != null) fs.close(); if(fs != null) fs.close();
if(cluster != null) cluster.shutdown(); if(cluster != null) cluster.shutdown();
} }
@Before
public void setup() throws IOException {
parent = new Path("/test");
fs.delete(parent, true);
}
/** /**
* Truncate files of different sizes byte by byte. * Truncate files of different sizes byte by byte.
*/ */