HDFS-4607. In TestGetConf.testGetSpecificKey(), use a platform-specific line separator; otherwise, it fails on Windows. Contributed by Ivan Mitic

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1459573 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tsz-wo Sze 2013-03-21 23:11:20 +00:00
parent 28bac40295
commit 1b98d8dda3
2 changed files with 12 additions and 8 deletions

View File

@ -436,6 +436,9 @@ Release 2.0.5-beta - UNRELEASED
HDFS-4620. Documentation for dfs.namenode.rpc-address specifies wrong HDFS-4620. Documentation for dfs.namenode.rpc-address specifies wrong
format. (Sandy Ryza via atm) format. (Sandy Ryza via atm)
HDFS-4607. In TestGetConf.testGetSpecificKey(), use a platform-specific
line separator; otherwise, it fails on Windows. (Ivan Mitic via szetszwo)
Release 2.0.4-alpha - UNRELEASED Release 2.0.4-alpha - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -224,7 +224,7 @@ public class TestGetConf {
/** /**
* Test empty configuration * Test empty configuration
*/ */
@Test @Test(timeout=10000)
public void testEmptyConf() throws Exception { public void testEmptyConf() throws Exception {
HdfsConfiguration conf = new HdfsConfiguration(false); HdfsConfiguration conf = new HdfsConfiguration(false);
// Verify getting addresses fails // Verify getting addresses fails
@ -247,7 +247,7 @@ public class TestGetConf {
/** /**
* Test invalid argument to the tool * Test invalid argument to the tool
*/ */
@Test @Test(timeout=10000)
public void testInvalidArgument() throws Exception { public void testInvalidArgument() throws Exception {
HdfsConfiguration conf = new HdfsConfiguration(); HdfsConfiguration conf = new HdfsConfiguration();
String[] args = {"-invalidArgument"}; String[] args = {"-invalidArgument"};
@ -259,7 +259,7 @@ public class TestGetConf {
* Tests to make sure the returned addresses are correct in case of default * Tests to make sure the returned addresses are correct in case of default
* configuration with no federation * configuration with no federation
*/ */
@Test @Test(timeout=10000)
public void testNonFederation() throws Exception { public void testNonFederation() throws Exception {
HdfsConfiguration conf = new HdfsConfiguration(false); HdfsConfiguration conf = new HdfsConfiguration(false);
@ -294,7 +294,7 @@ public class TestGetConf {
* Tests to make sure the returned addresses are correct in case of federation * Tests to make sure the returned addresses are correct in case of federation
* of setup. * of setup.
*/ */
@Test @Test(timeout=10000)
public void testFederation() throws Exception { public void testFederation() throws Exception {
final int nsCount = 10; final int nsCount = 10;
HdfsConfiguration conf = new HdfsConfiguration(false); HdfsConfiguration conf = new HdfsConfiguration(false);
@ -333,15 +333,16 @@ public class TestGetConf {
verifyAddresses(conf, TestType.NNRPCADDRESSES, true, nnAddresses); verifyAddresses(conf, TestType.NNRPCADDRESSES, true, nnAddresses);
} }
@Test @Test(timeout=10000)
public void testGetSpecificKey() throws Exception { public void testGetSpecificKey() throws Exception {
HdfsConfiguration conf = new HdfsConfiguration(); HdfsConfiguration conf = new HdfsConfiguration();
conf.set("mykey", " myval "); conf.set("mykey", " myval ");
String[] args = {"-confKey", "mykey"}; String[] args = {"-confKey", "mykey"};
assertTrue(runTool(conf, args, true).equals("myval\n")); String toolResult = runTool(conf, args, true);
assertEquals(String.format("myval%n"), toolResult);
} }
@Test @Test(timeout=10000)
public void testExtraArgsThrowsError() throws Exception { public void testExtraArgsThrowsError() throws Exception {
HdfsConfiguration conf = new HdfsConfiguration(); HdfsConfiguration conf = new HdfsConfiguration();
conf.set("mykey", "myval"); conf.set("mykey", "myval");
@ -354,7 +355,7 @@ public class TestGetConf {
* Tests commands other than {@link Command#NAMENODE}, {@link Command#BACKUP}, * Tests commands other than {@link Command#NAMENODE}, {@link Command#BACKUP},
* {@link Command#SECONDARY} and {@link Command#NNRPCADDRESSES} * {@link Command#SECONDARY} and {@link Command#NNRPCADDRESSES}
*/ */
@Test @Test(timeout=10000)
public void testTool() throws Exception { public void testTool() throws Exception {
HdfsConfiguration conf = new HdfsConfiguration(false); HdfsConfiguration conf = new HdfsConfiguration(false);
for (Command cmd : Command.values()) { for (Command cmd : Command.values()) {