hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject svn commit: r1346279 - in /hadoop/common/branches/branch-0.22/mapreduce: ./ src/java/org/apache/hadoop/mapred/ src/test/mapred/org/apache/hadoop/mapred/
Date Tue, 05 Jun 2012 07:56:49 GMT
Author: shv
Date: Tue Jun  5 07:56:48 2012
New Revision: 1346279

URL: http://svn.apache.org/viewvc?rev=1346279&view=rev
Log:
MAPREDUCE-4247. Fix TestTaskTrackerLocalization. Contributed by Benoy Antony.

Modified:
    hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt
    hadoop/common/branches/branch-0.22/mapreduce/src/java/org/apache/hadoop/mapred/TaskTracker.java
    hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/TestLocalizationWithLinuxTaskController.java
    hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/TestTaskTrackerLocalization.java

Modified: hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt?rev=1346279&r1=1346278&r2=1346279&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt Tue Jun  5 07:56:48 2012
@@ -67,6 +67,8 @@ Release 0.22.1 - Unreleased
     MAPREDUCE-4246. Failure in deleting user directories in secure Hadoop.
     (Benoy Antony via shv)
 
+    MAPREDUCE-4247. Fix TestTaskTrackerLocalization. (Benoy Antony via shv)
+
 Release 0.22.0 - 2011-11-29
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-0.22/mapreduce/src/java/org/apache/hadoop/mapred/TaskTracker.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/mapreduce/src/java/org/apache/hadoop/mapred/TaskTracker.java?rev=1346279&r1=1346278&r2=1346279&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/mapreduce/src/java/org/apache/hadoop/mapred/TaskTracker.java
(original)
+++ hadoop/common/branches/branch-0.22/mapreduce/src/java/org/apache/hadoop/mapred/TaskTracker.java
Tue Jun  5 07:56:48 2012
@@ -4070,6 +4070,10 @@ public class TaskTracker 
     return distributedCacheManager;
   }
   
+  void setTrackerDistributedCacheManager(TrackerDistributedCacheManager distributedCacheManager)
{
+     this.distributedCacheManager = distributedCacheManager;
+  }
+  
   /**
    * Download the job-token file from the FS and save on local fs.
    * @param user

Modified: hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/TestLocalizationWithLinuxTaskController.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/TestLocalizationWithLinuxTaskController.java?rev=1346279&r1=1346278&r2=1346279&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/TestLocalizationWithLinuxTaskController.java
(original)
+++ hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/TestLocalizationWithLinuxTaskController.java
Tue Jun  5 07:56:48 2012
@@ -16,7 +16,9 @@
  * limitations under the License.
  */
 package org.apache.hadoop.mapred;
-
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -49,7 +51,7 @@ public class TestLocalizationWithLinuxTa
   }
 
   @Override
-  protected void setUp()
+  public void setUp()
       throws Exception {
 
     if (!canRun()) {
@@ -63,7 +65,7 @@ public class TestLocalizationWithLinuxTa
   }
 
   @Override
-  protected void tearDown()
+  public void tearDown()
       throws Exception {
     if (!canRun()) {
       return;

Modified: hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/TestTaskTrackerLocalization.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/TestTaskTrackerLocalization.java?rev=1346279&r1=1346278&r2=1346279&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/TestTaskTrackerLocalization.java
(original)
+++ hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/TestTaskTrackerLocalization.java
Tue Jun  5 07:56:48 2012
@@ -17,6 +17,11 @@
  */
 package org.apache.hadoop.mapred;
 
+import static org.apache.hadoop.mapred.QueueManager.toFullPropertyName;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
@@ -34,6 +39,9 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.FileUtil;
 import org.apache.hadoop.fs.LocalDirAllocator;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.mapred.TaskTracker.RunningJob;
+import org.apache.hadoop.mapred.TaskTracker.TaskInProgress;
+import org.apache.hadoop.mapred.UtilsForTests.InlineCleanupQueue;
 import org.apache.hadoop.mapreduce.Job;
 import org.apache.hadoop.mapreduce.MRConfig;
 import org.apache.hadoop.mapreduce.MRJobConfig;
@@ -42,26 +50,20 @@ import org.apache.hadoop.mapreduce.filec
 import org.apache.hadoop.mapreduce.security.TokenCache;
 import org.apache.hadoop.mapreduce.server.tasktracker.Localizer;
 import org.apache.hadoop.mapreduce.util.MRAsyncDiskService;
-
-import static org.apache.hadoop.mapred.QueueManager.toFullPropertyName;
 import org.apache.hadoop.security.Credentials;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.util.Shell;
-import org.apache.hadoop.mapred.JvmManager.JvmEnv;
-import org.apache.hadoop.mapred.TaskTracker.RunningJob;
-import org.apache.hadoop.mapred.TaskTracker.TaskInProgress;
-import org.apache.hadoop.mapred.UtilsForTests.InlineCleanupQueue;
-
-import junit.framework.TestCase;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Ignore;
+import org.junit.Test;
 
 /**
  * Test to verify localization of a job and localization of a task on a
  * TaskTracker.
  * 
  */
-@Ignore // test relies on deprecated functionality/lifecycle
-public class TestTaskTrackerLocalization extends TestCase {
+public class TestTaskTrackerLocalization  {
 
   private static File TEST_ROOT_DIR = 
     new File(System.getProperty("test.build.data", "/tmp"));
@@ -101,9 +103,8 @@ public class TestTaskTrackerLocalization
   protected boolean canRun() {
     return true;
   }
-
-  @Override
-  protected void setUp()
+  @Before
+  public void setUp()
       throws Exception {
     if (!canRun()) {
       return;
@@ -182,14 +183,8 @@ public class TestTaskTrackerLocalization
     // Set up the TaskTracker
     tracker = new TaskTracker();
     tracker.setConf(trackerFConf);
-    // setup task controller
-    taskController = createTaskController();
-    taskController.setConf(trackerFConf);
-    taskController.setup(lDirAlloc);
-    tracker.setTaskController(taskController);
-    tracker.setLocalizer(new Localizer(tracker.getLocalFileSystem(),localDirs));
     tracker.setTaskLogCleanupThread(new UserLogCleaner(trackerFConf, 
-                                        taskController));
+        taskController));
     initializeTracker();
   }
 
@@ -210,7 +205,19 @@ public class TestTaskTrackerLocalization
     // Set up TaskTracker instrumentation
     tracker.setTaskTrackerInstrumentation(
         TaskTracker.createInstrumentation(tracker, trackerFConf));
-
+    
+    // setup task controller
+    taskController = createTaskController();
+    taskController.setConf(trackerFConf);
+    taskController.setup(lDirAlloc);
+    tracker.setTaskController(taskController);
+    tracker.setLocalizer(new Localizer(tracker.getLocalFileSystem(),localDirs));
+    
+    // Initialize DistributedCache
+    tracker.setTrackerDistributedCacheManager(
+        new TrackerDistributedCacheManager(trackerFConf, taskController,
+            tracker.getAsyncDiskService()));
+    tracker.getTrackerDistributedCacheManager().startCleanupThread();
   }
 
   protected TaskController createTaskController() {
@@ -309,8 +316,8 @@ public class TestTaskTrackerLocalization
         TokenCache.JOB_TOKEN_HDFS_FILE), new Configuration());
   }
 
-  @Override
-  protected void tearDown()
+  @After
+  public void tearDown()
       throws Exception {
     if (!canRun()) {
       return;
@@ -357,6 +364,7 @@ public class TestTaskTrackerLocalization
    * 
    * @throws IOException
    */
+  @Test
   public void testTaskControllerSetup()
       throws IOException {
     if (!canRun()) {
@@ -383,6 +391,7 @@ public class TestTaskTrackerLocalization
    * 
    * @throws IOException
    */
+  @Test
   public void testUserLocalization()
       throws IOException {
     if (!canRun()) {
@@ -458,6 +467,7 @@ public class TestTaskTrackerLocalization
    * 
    * @throws IOException
    */
+  @Test
   public void testJobLocalization()
       throws Exception {
     if (!canRun()) {
@@ -474,6 +484,7 @@ public class TestTaskTrackerLocalization
    * during localization rather than at the time when the task itself
    * tries to write into it.
    */
+ @Test
   public void testJobLocalizationFailsIfLogDirUnwritable()
       throws Exception {
     if (!canRun()) {
@@ -567,7 +578,7 @@ public class TestTaskTrackerLocalization
     File jobLogDir = TaskLog.getJobDir(jobId);
     assertTrue("job log directory " + jobLogDir + " does not exist!", jobLogDir
         .exists());
-    checkFilePermissions(jobLogDir.toString(), "drwx------", task.getUser(),
+    checkFilePermissions(jobLogDir.toString(), "drwx--x---", task.getUser(),
         taskTrackerUGI.getGroupNames()[0]);
 
     // Make sure that the job ACLs file job-acls.xml exists in job userlog dir
@@ -577,7 +588,7 @@ public class TestTaskTrackerLocalization
 
     // With default task controller, the job-acls.xml file is owned by TT and
     // permissions are 700
-    checkFilePermissions(jobACLsFile.getAbsolutePath(), "-rw-------",
+    checkFilePermissions(jobACLsFile.getAbsolutePath(), "-rw-r-----",
         taskTrackerUGI.getShortUserName(), taskTrackerUGI.getGroupNames()[0]);
 
     validateJobACLsFileContent();
@@ -607,6 +618,7 @@ public class TestTaskTrackerLocalization
    * 
    * @throws IOException
    */
+  @Ignore // test relies on deprecated functionality/lifecycle
   public void testTaskLocalization()
       throws Exception {
     if (!canRun()) {
@@ -796,6 +808,7 @@ public class TestTaskTrackerLocalization
    * Validates if task cleanup is done properly for a succeeded task
    * @throws IOException
    */
+  @Ignore // test relies on deprecated functionality/lifecycle
   public void testTaskFilesRemoval()
       throws Exception {
     if (!canRun()) {
@@ -808,6 +821,7 @@ public class TestTaskTrackerLocalization
    * Validates if task cleanup is done properly for a task that is not succeeded
    * @throws IOException
    */
+  @Ignore // test relies on deprecated functionality/lifecycle
   public void testFailedTaskFilesRemoval()
   throws Exception {
     if (!canRun()) {
@@ -829,6 +843,7 @@ public class TestTaskTrackerLocalization
    * Validates if task cleanup is done properly for a succeeded task
    * @throws IOException
    */
+  @Ignore // test relies on deprecated functionality/lifecycle
   public void testTaskFilesRemovalWithJvmUse()
       throws Exception {
     if (!canRun()) {
@@ -882,6 +897,7 @@ public class TestTaskTrackerLocalization
    *   - create files with no write permissions to TT under job-work-dir
    *   - create files with no write permissions to TT under task-work-dir
    */
+  @Ignore // test relies on deprecated functionality/lifecycle
   public void testJobFilesRemoval() throws IOException, InterruptedException {
     if (!canRun()) {
       return;
@@ -974,6 +990,7 @@ public class TestTaskTrackerLocalization
    * @throws IOException
    * @throws InterruptedException
    */
+  @Ignore // test relies on deprecated functionality/lifecycle
   public void testTrackerRestart() throws IOException, InterruptedException {
     if (!canRun()) {
       return;
@@ -1015,6 +1032,7 @@ public class TestTaskTrackerLocalization
    * @throws IOException
    * @throws InterruptedException
    */
+  @Ignore // test relies on deprecated functionality/lifecycle
   public void testTrackerReinit() throws IOException, InterruptedException {
     if (!canRun()) {
       return;
@@ -1050,6 +1068,7 @@ public class TestTaskTrackerLocalization
    * @throws InterruptedException 
    * @throws IOException 
    */
+  @Ignore // test relies on deprecated functionality/lifecycle
   public void testCleanupTaskLocalization() throws IOException,
       InterruptedException {
     if (!canRun()) {



Mime
View raw message