svn merge -c 1332716. FIXES: MAPREDUCE-4202. TestYarnClientProtocolProvider is broken (Daryn Sharp via bobby)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1332719 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Joseph Evans 2012-05-01 16:02:31 +00:00
parent 848a2026f2
commit 5765eb1868
3 changed files with 21 additions and 7 deletions

View File

@ -327,6 +327,9 @@ Release 0.23.3 - UNRELEASED
MAPREDUCE-4211. Error conditions (missing appid, appid not found) are MAPREDUCE-4211. Error conditions (missing appid, appid not found) are
masked in the RM app page (Jonathan Eagles via bobby) masked in the RM app page (Jonathan Eagles via bobby)
MAPREDUCE-4202. TestYarnClientProtocolProvider is broken (Daryn Sharp via
bobby)
Release 0.23.2 - UNRELEASED Release 0.23.2 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -33,8 +33,9 @@ public class LocalClientProtocolProvider extends ClientProtocolProvider {
@Override @Override
public ClientProtocol create(Configuration conf) throws IOException { public ClientProtocol create(Configuration conf) throws IOException {
String framework = conf.get(MRConfig.FRAMEWORK_NAME); String framework =
if (framework != null && !framework.equals(MRConfig.LOCAL_FRAMEWORK_NAME)) { conf.get(MRConfig.FRAMEWORK_NAME, MRConfig.LOCAL_FRAMEWORK_NAME);
if (!MRConfig.LOCAL_FRAMEWORK_NAME.equals(framework)) {
return null; return null;
} }
String tracker = conf.get(JTConfig.JT_IPC_ADDRESS, "local"); String tracker = conf.get(JTConfig.JT_IPC_ADDRESS, "local");

View File

@ -28,6 +28,7 @@ import junit.framework.TestCase;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text; import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.LocalJobRunner;
import org.apache.hadoop.mapred.ResourceMgrDelegate; import org.apache.hadoop.mapred.ResourceMgrDelegate;
import org.apache.hadoop.mapred.YARNRunner; import org.apache.hadoop.mapred.YARNRunner;
import org.apache.hadoop.mapreduce.protocol.ClientProtocol; import org.apache.hadoop.mapreduce.protocol.ClientProtocol;
@ -54,17 +55,26 @@ public class TestYarnClientProtocolProvider extends TestCase {
try { try {
cluster = new Cluster(conf); cluster = new Cluster(conf);
fail("Cluster should not be initialized with out any framework name"); } catch (Exception e) {
} catch (IOException e) { throw new Exception(
"Failed to initialize a local runner w/o a cluster framework key", e);
} }
try {
assertTrue("client is not a LocalJobRunner",
cluster.getClient() instanceof LocalJobRunner);
} finally {
if (cluster != null) {
cluster.close();
}
}
try { try {
conf = new Configuration(); conf = new Configuration();
conf.set(MRConfig.FRAMEWORK_NAME, MRConfig.YARN_FRAMEWORK_NAME); conf.set(MRConfig.FRAMEWORK_NAME, MRConfig.YARN_FRAMEWORK_NAME);
cluster = new Cluster(conf); cluster = new Cluster(conf);
ClientProtocol client = cluster.getClient(); ClientProtocol client = cluster.getClient();
assertTrue(client instanceof YARNRunner); assertTrue("client is a YARNRunner", client instanceof YARNRunner);
} catch (IOException e) { } catch (IOException e) {
} finally { } finally {