Skip to content

Commit

Permalink
Amending OOZIE-2260 to fix test case failures against hadoop-2 (ryota)
Browse files Browse the repository at this point in the history
  • Loading branch information
egashira committed Jun 23, 2015
1 parent d425d83 commit 168de66
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
Expand Up @@ -50,6 +50,7 @@
import org.apache.oozie.client.OozieClient;
import org.apache.oozie.client.WorkflowAction;
import org.apache.oozie.client.WorkflowJob;
import org.apache.oozie.hadoop.utils.HadoopShims;
import org.apache.oozie.service.ConfigurationService;
import org.apache.oozie.service.HadoopAccessorService;
import org.apache.oozie.service.LiteWorkflowStoreService;
Expand Down Expand Up @@ -1781,7 +1782,12 @@ public void testUpdateConfForJavaTmpDir() throws Exception {
assertEquals("-Xmx200m", jobConf.get(JavaActionExecutor.HADOOP_CHILD_JAVA_OPTS));
assertEquals("-Xmx1024m -Djava.io.tmpdir=./usr", jobConf.get(JavaActionExecutor.HADOOP_MAP_JAVA_OPTS));
assertEquals("-Xmx2560m -XX:NewRatio=8", jobConf.get(JavaActionExecutor.HADOOP_REDUCE_JAVA_OPTS));
assertNull(jobConf.get(JavaActionExecutor.YARN_AM_COMMAND_OPTS));
// There's an extra parameter (-Xmx1024m) in here when using YARN that's not here when using MR1
if (HadoopShims.isYARN()) {
assertEquals("-Xmx1024m -Djava.io.tmpdir=./tmp", jobConf.get(JavaActionExecutor.YARN_AM_COMMAND_OPTS));
} else {
assertNull(jobConf.get(JavaActionExecutor.YARN_AM_COMMAND_OPTS));
}
}
public void testUpdateConfForUberMode() throws Exception {
Element actionXml1 = XmlUtils
Expand Down Expand Up @@ -1818,8 +1824,8 @@ public void testUpdateConfForUberMode() throws Exception {
assertEquals("-Xmx2048m -Djava.net.preferIPv4Stack=true",
launcherConf.get("mapreduce.map.java.opts"));
// There's an extra parameter (-Xmx1024m) in here when using YARN that's not here when using MR1
if (createJobConf().get("yarn.resourcemanager.address") != null) {
assertEquals("-Xmx1024m -Xmx2048m -Djava.net.preferIPv4Stack=true -Xmx2560m",
if (HadoopShims.isYARN()) {
assertEquals("-Xmx1024m -Xmx2048m -Djava.net.preferIPv4Stack=true -Xmx2560m -Djava.io.tmpdir=./tmp",
launcherConf.get(JavaActionExecutor.YARN_AM_COMMAND_OPTS).trim());
}
else {
Expand Down Expand Up @@ -2137,14 +2143,21 @@ public void testUpdateConfForTimeLineServiceEnabled() throws Exception {

// Test when server side setting is not enabled
JobConf launcherConf = ae.createLauncherConf(getFileSystem(), context, action, actionXml, actionConf);
assertNull(launcherConf.get(JavaActionExecutor.HADOOP_YARN_TIMELINE_SERVICE_ENABLED));
if (HadoopShims.isYARN()) {
assertEquals("true", launcherConf.get(JavaActionExecutor.HADOOP_YARN_TIMELINE_SERVICE_ENABLED));
} else {
assertNull(launcherConf.get(JavaActionExecutor.HADOOP_YARN_TIMELINE_SERVICE_ENABLED));
}

ConfigurationService.set("oozie.action.launcher." + JavaActionExecutor.HADOOP_YARN_TIMELINE_SERVICE_ENABLED, "true");

// Test when server side setting is enabled but tez-site.xml is not in DistributedCache
launcherConf = ae.createLauncherConf(getFileSystem(), context, action, actionXml, actionConf);
assertNull(launcherConf.get(JavaActionExecutor.HADOOP_YARN_TIMELINE_SERVICE_ENABLED));

if (HadoopShims.isYARN()) {
assertEquals("true", launcherConf.get(JavaActionExecutor.HADOOP_YARN_TIMELINE_SERVICE_ENABLED));
} else {
assertNull(launcherConf.get(JavaActionExecutor.HADOOP_YARN_TIMELINE_SERVICE_ENABLED));
}
final Path tezSite = new Path("/tmp/tez-site.xml");
final FSDataOutputStream out = getFileSystem().create(tezSite);
out.close();
Expand Down Expand Up @@ -2234,9 +2247,9 @@ public void testAddToCache() throws Exception {
conf.set(WorkflowAppService.HADOOP_USER, getTestUser());
ae.addToCache(conf, appPath, appJarFullPath.toString(), false);
// assert that mapred.cache.files contains jar URI path (full on Hadoop-2)
Path jarPath = createJobConf().get("yarn.resourcemanager.address") == null ?
new Path(appJarFullPath.toUri().getPath()) :
new Path(appJarFullPath.toUri());
Path jarPath = HadoopShims.isYARN() ?
new Path(appJarFullPath.toUri()):
new Path(appJarFullPath.toUri().getPath());
assertTrue(conf.get("mapred.cache.files").contains(jarPath.toString()));
// assert that dist cache classpath contains jar URI path
Path[] paths = DistributedCache.getFileClassPaths(conf);
Expand Down
Expand Up @@ -44,7 +44,7 @@ public boolean isSymlink(Path p) throws IOException {
public void createSymlink(Path target, Path link, boolean createParent) throws IOException {
}

public boolean isYARN() {
public static boolean isYARN() {
return false;
}

Expand Down
Expand Up @@ -61,7 +61,7 @@ public void createSymlink(Path target, Path link, boolean createParent) throws I
fs.createSymlink(target, link, createParent);
}

public boolean isYARN() {
public static boolean isYARN() {
return true;
}

Expand Down
Expand Up @@ -61,7 +61,7 @@ public void createSymlink(Path target, Path link, boolean createParent) throws I
fs.createSymlink(target, link, createParent);
}

public boolean isYARN() {
public static boolean isYARN() {
return true;
}

Expand Down

0 comments on commit 168de66

Please sign in to comment.