HDFS-8039. Fix TestDebugAdmin#testRecoverLease and testVerfiyBlockChecksumCommand on Windows. Contributed by Xiaoyu Yao.

(cherry picked from commit db80e42891)
(cherry picked from commit 28e0602e7b)

Conflicts:
	hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
This commit is contained in:
cnauroth 2015-04-03 10:44:02 -07:00
parent b08bc43c9b
commit 6855bbc6ca
2 changed files with 11 additions and 7 deletions

View File

@ -956,6 +956,9 @@ Release 2.7.0 - UNRELEASED
HDFS-7954. TestBalancer#testBalancerWithPinnedBlocks should not be executed HDFS-7954. TestBalancer#testBalancerWithPinnedBlocks should not be executed
on Windows. (Xiaoyu Yao via szetszwo) on Windows. (Xiaoyu Yao via szetszwo)
HDFS-8039. Fix TestDebugAdmin#testRecoverLease and
testVerifyBlockChecksumCommand on Windows. (Xiaoyu Yao via cnauroth)
BREAKDOWN OF HDFS-7584 SUBTASKS AND RELATED JIRAS BREAKDOWN OF HDFS-7584 SUBTASKS AND RELATED JIRAS
HDFS-7720. Quota by Storage Type API, tools and ClientNameNode HDFS-7720. Quota by Storage Type API, tools and ClientNameNode

View File

@ -77,17 +77,18 @@ public class TestDebugAdmin {
System.setOut(oldOut); System.setOut(oldOut);
IOUtils.closeStream(out); IOUtils.closeStream(out);
} }
return "ret: " + ret + ", " + bytes.toString(); return "ret: " + ret + ", " +
bytes.toString().replaceAll(System.getProperty("line.separator"), "");
} }
@Test(timeout = 60000) @Test(timeout = 60000)
public void testRecoverLease() throws Exception { public void testRecoverLease() throws Exception {
assertEquals("ret: 1, You must supply a -path argument to recoverLease.\n", assertEquals("ret: 1, You must supply a -path argument to recoverLease.",
runCmd(new String[]{"recoverLease", "-retries", "1"})); runCmd(new String[]{"recoverLease", "-retries", "1"}));
FSDataOutputStream out = fs.create(new Path("/foo")); FSDataOutputStream out = fs.create(new Path("/foo"));
out.write(123); out.write(123);
out.close(); out.close();
assertEquals("ret: 0, recoverLease SUCCEEDED on /foo\n", assertEquals("ret: 0, recoverLease SUCCEEDED on /foo",
runCmd(new String[]{"recoverLease", "-path", "/foo"})); runCmd(new String[]{"recoverLease", "-path", "/foo"}));
} }
@ -98,18 +99,18 @@ public class TestDebugAdmin {
ExtendedBlock block = DFSTestUtil.getFirstBlock(fs, new Path("/bar")); ExtendedBlock block = DFSTestUtil.getFirstBlock(fs, new Path("/bar"));
File blockFile = getBlockFile(fsd, File blockFile = getBlockFile(fsd,
block.getBlockPoolId(), block.getLocalBlock()); block.getBlockPoolId(), block.getLocalBlock());
assertEquals("ret: 1, You must specify a meta file with -meta\n", assertEquals("ret: 1, You must specify a meta file with -meta",
runCmd(new String[]{"verify", "-block", blockFile.getAbsolutePath()})); runCmd(new String[]{"verify", "-block", blockFile.getAbsolutePath()}));
File metaFile = getMetaFile(fsd, File metaFile = getMetaFile(fsd,
block.getBlockPoolId(), block.getLocalBlock()); block.getBlockPoolId(), block.getLocalBlock());
assertEquals("ret: 0, Checksum type: " + assertEquals("ret: 0, Checksum type: " +
"DataChecksum(type=CRC32C, chunkSize=512)\n", "DataChecksum(type=CRC32C, chunkSize=512)",
runCmd(new String[]{"verify", runCmd(new String[]{"verify",
"-meta", metaFile.getAbsolutePath()})); "-meta", metaFile.getAbsolutePath()}));
assertEquals("ret: 0, Checksum type: " + assertEquals("ret: 0, Checksum type: " +
"DataChecksum(type=CRC32C, chunkSize=512)\n" + "DataChecksum(type=CRC32C, chunkSize=512)" +
"Checksum verification succeeded on block file " + "Checksum verification succeeded on block file " +
blockFile.getAbsolutePath() + "\n", blockFile.getAbsolutePath(),
runCmd(new String[]{"verify", runCmd(new String[]{"verify",
"-meta", metaFile.getAbsolutePath(), "-meta", metaFile.getAbsolutePath(),
"-block", blockFile.getAbsolutePath()}) "-block", blockFile.getAbsolutePath()})