HDFS-3199. TestValidateConfigurationSettings is failing. Contributed by Todd Lipcon

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1309641 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2012-04-05 03:31:03 +00:00
parent 4f6e0a5a65
commit 663fbd46a8
2 changed files with 24 additions and 5 deletions

View File

@ -417,6 +417,8 @@ Release 2.0.0 - UNRELEASED
HDFS-3174. Fix assert in TestPendingDataNodeMessages. (eli) HDFS-3174. Fix assert in TestPendingDataNodeMessages. (eli)
HDFS-3199. TestValidateConfigurationSettings is failing. (todd via eli)
BREAKDOWN OF HDFS-1623 SUBTASKS BREAKDOWN OF HDFS-1623 SUBTASKS
HDFS-2179. Add fencing framework and mechanisms for NameNode HA. (todd) HDFS-2179. Add fencing framework and mechanisms for NameNode HA. (todd)

View File

@ -28,6 +28,8 @@
import org.apache.hadoop.hdfs.DFSTestUtil; import org.apache.hadoop.hdfs.DFSTestUtil;
import org.apache.hadoop.hdfs.HdfsConfiguration; import org.apache.hadoop.hdfs.HdfsConfiguration;
import org.apache.hadoop.hdfs.DFSConfigKeys; import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.hadoop.test.GenericTestUtils;
/** /**
* This class tests the validation of the configuration object when passed * This class tests the validation of the configuration object when passed
@ -72,6 +74,7 @@ public void testThatDifferentRPCandHttpPortsAreOK()
conf.set(DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY, "127.0.0.1:9000"); conf.set(DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY, "127.0.0.1:9000");
DFSTestUtil.formatNameNode(conf); DFSTestUtil.formatNameNode(conf);
NameNode nameNode = new NameNode(conf); // should be OK! NameNode nameNode = new NameNode(conf); // should be OK!
nameNode.stop();
} }
/** /**
@ -82,16 +85,30 @@ public void testThatDifferentRPCandHttpPortsAreOK()
public void testGenericKeysForNameNodeFormat() public void testGenericKeysForNameNodeFormat()
throws IOException { throws IOException {
Configuration conf = new HdfsConfiguration(); Configuration conf = new HdfsConfiguration();
FileSystem.setDefaultUri(conf, "hdfs://localhost:8070");
// Set ephemeral ports
conf.set(DFSConfigKeys.DFS_NAMENODE_RPC_ADDRESS_KEY,
"127.0.0.1:0");
conf.set(DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY,
"127.0.0.1:0");
conf.set(DFSConfigKeys.DFS_FEDERATION_NAMESERVICES, "ns1"); conf.set(DFSConfigKeys.DFS_FEDERATION_NAMESERVICES, "ns1");
String nameDir = System.getProperty("java.io.tmpdir") + "/test.dfs.name";
File dir = new File(nameDir); // Set a nameservice-specific configuration for name dir
File dir = new File(MiniDFSCluster.getBaseDirectory(),
"testGenericKeysForNameNodeFormat");
if (dir.exists()) { if (dir.exists()) {
FileUtil.fullyDelete(dir); FileUtil.fullyDelete(dir);
} }
conf.set(DFSConfigKeys.DFS_NAMENODE_NAME_DIR_KEY + ".ns1", nameDir); conf.set(DFSConfigKeys.DFS_NAMENODE_NAME_DIR_KEY + ".ns1",
dir.getAbsolutePath());
// Format and verify the right dir is formatted.
DFSTestUtil.formatNameNode(conf); DFSTestUtil.formatNameNode(conf);
GenericTestUtils.assertExists(dir);
// Ensure that the same dir is picked up by the running NN
NameNode nameNode = new NameNode(conf); NameNode nameNode = new NameNode(conf);
FileUtil.fullyDelete(dir); nameNode.stop();
} }
} }