Browse Source

MAPREDUCE-4696. Fixed a failing unit test - TestMRServerPorts. (Contributed by Gopal V)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1@1417673 13f79535-47bb-0310-9956-ffa450edef68
Siddharth Seth 12 years ago
parent
commit
dc62d59caa
2 changed files with 9 additions and 2 deletions
  1. 3 0
      CHANGES.txt
  2. 6 2
      src/test/org/apache/hadoop/mapred/TestMRServerPorts.java

+ 3 - 0
CHANGES.txt

@@ -354,6 +354,9 @@ Release 1.1.2 - Unreleased
     MAPREDUCE-4478. Fixed a bug in TaskTracker's heartbeat to keep it under
     control. (Liyin Liang via vinodkv)
 
+    MAPREDUCE-4696. Fixed a failing unit test - TestMRServerPorts
+    (Gopal V via sseth)
+
 Release 1.1.1 - 2012.11.18
 
   INCOMPATIBLE CHANGES

+ 6 - 2
src/test/org/apache/hadoop/mapred/TestMRServerPorts.java

@@ -18,6 +18,8 @@
 package org.apache.hadoop.mapred;
 
 import java.io.IOException;
+import java.util.Date;
+import java.text.SimpleDateFormat;
 import junit.framework.TestCase;
 import org.apache.hadoop.hdfs.TestHDFSServerPorts;
 import org.apache.hadoop.hdfs.server.datanode.DataNode;
@@ -62,7 +64,8 @@ public class TestMRServerPorts extends TestCase {
     conf.set("mapred.job.tracker.http.address", "0.0.0.0:0");
     JobTracker jt = null;
     try {
-      jt = JobTracker.startTracker(conf);
+      String uniqid = new SimpleDateFormat("yyyyMMddHHmm").format(new Date());
+      jt = JobTracker.startTracker(conf, uniqid, true);
       runner.setJobTracker(jt);
       runner.start();
       conf.set("mapred.job.tracker", "localhost:" + jt.getTrackerPort());
@@ -90,7 +93,8 @@ public class TestMRServerPorts extends TestCase {
   throws IOException, InterruptedException {
     JobTracker jt = null;
     try {
-      jt = JobTracker.startTracker(conf);
+      String uniqid = new SimpleDateFormat("yyyyMMddHHmm").format(new Date());
+      jt = JobTracker.startTracker(conf, uniqid, true);
     } catch(IOException e) {
       if (e instanceof java.net.BindException)
         return false;