hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdoug...@apache.org
Subject svn commit: r941506 - in /hadoop/mapreduce/trunk: CHANGES.txt build.xml src/test/mapred/org/apache/hadoop/mapred/TestTaskTrackerMemoryManager.java
Date Wed, 05 May 2010 21:35:44 GMT
Author: cdouglas
Date: Wed May  5 21:35:44 2010
New Revision: 941506

URL: http://svn.apache.org/viewvc?rev=941506&view=rev
Log:
MAPREDUCE-1092. Enable assertions for unit tests. Contributed by Eli Collins

Modified:
    hadoop/mapreduce/trunk/CHANGES.txt
    hadoop/mapreduce/trunk/build.xml
    hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestTaskTrackerMemoryManager.java

Modified: hadoop/mapreduce/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/CHANGES.txt?rev=941506&r1=941505&r2=941506&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/CHANGES.txt (original)
+++ hadoop/mapreduce/trunk/CHANGES.txt Wed May  5 21:35:44 2010
@@ -8,8 +8,11 @@ Trunk (unreleased changes)
 
   IMPROVEMENTS
 
-  MAPREDUCE-1546. Redirect all job pages to corresponding history page 
-  if job is not in JT memory. (Scott Chen via sharad)
+    MAPREDUCE-1546. Redirect all job pages to corresponding history page
+    if job is not in JT memory. (Scott Chen via sharad)
+
+    MAPREDUCE-1092. Enable assertions for unit tests. (Eli Collins via
+    cdouglas)
 
   OPTIMIZATIONS
 

Modified: hadoop/mapreduce/trunk/build.xml
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/build.xml?rev=941506&r1=941505&r2=941506&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/build.xml (original)
+++ hadoop/mapreduce/trunk/build.xml Wed May  5 21:35:44 2010
@@ -110,6 +110,7 @@
   <property name="test.junit.printsummary" value="yes" />
   <property name="test.junit.haltonfailure" value="no" />
   <property name="test.junit.maxmemory" value="512m" />
+  <property name="test.junit.jvmargs" value="-ea" />
   <property name="test.tmp.dir" value="${env.TMP}" />
   <property name="test.temp.dir" value="${env.TEMP}" />
   <property name="test.conf.dir" value="${build.dir}/test/conf" />
@@ -625,6 +626,7 @@
         maxmemory="${test.junit.maxmemory}"
         dir="${basedir}" timeout="${test.timeout}"
         errorProperty="tests.failed" failureProperty="tests.failed">
+        <jvmarg value="${test.junit.jvmargs}" />
         <sysproperty key="test.build.data" value="${test.build.data}"/>
         <sysproperty key="test.tools.input.dir" value = "${test.tools.input.dir}"/>
         <sysproperty key="test.cache.data" value="${test.cache.data}"/>     

Modified: hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestTaskTrackerMemoryManager.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestTaskTrackerMemoryManager.java?rev=941506&r1=941505&r2=941506&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestTaskTrackerMemoryManager.java
(original)
+++ hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestTaskTrackerMemoryManager.java
Wed May  5 21:35:44 2010
@@ -42,12 +42,15 @@ import org.apache.hadoop.mapreduce.util.
 import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.util.ToolRunner;
 
-import junit.framework.TestCase;
+import org.junit.After;
+import org.junit.Ignore;
+import org.junit.Test;
+import static org.junit.Assert.*;
 
 /**
  * Test class to verify memory management of tasks.
  */
-public class TestTaskTrackerMemoryManager extends TestCase {
+public class TestTaskTrackerMemoryManager {
 
   private static final Log LOG =
       LogFactory.getLog(TestTaskTrackerMemoryManager.class);
@@ -69,8 +72,8 @@ public class TestTaskTrackerMemoryManage
     miniMRCluster = new MiniMRCluster(1, "file:///", 1, null, null, conf);
   }
 
-  @Override
-  protected void tearDown() {
+  @After
+  public void tearDown() {
     if (miniMRCluster != null) {
       miniMRCluster.shutdown();
     }
@@ -141,6 +144,7 @@ public class TestTaskTrackerMemoryManage
    * 
    * @throws Exception
    */
+  @Test
   public void testTTLimitsDisabled()
       throws Exception {
     // Run the test only if memory management is enabled
@@ -163,6 +167,7 @@ public class TestTaskTrackerMemoryManage
    * 
    * @throws Exception
    */
+  @Test
   public void testTasksWithinLimits()
       throws Exception {
     // Run the test only if memory management is enabled
@@ -195,6 +200,8 @@ public class TestTaskTrackerMemoryManage
    * 
    * @throws Exception
    */
+  @Ignore("Intermittent, unexpected task success causes test to fail.")
+  @Test
   public void testTasksBeyondLimits()
       throws Exception {
 
@@ -206,8 +213,7 @@ public class TestTaskTrackerMemoryManage
     // Start cluster with proper configuration.
     JobConf fConf = new JobConf();
     // very small value, so that no task escapes to successful completion.
-    fConf.set(TTConfig.TT_MEMORY_MANAGER_MONITORING_INTERVAL,
-        String.valueOf(300));
+    fConf.setInt(TTConfig.TT_MEMORY_MANAGER_MONITORING_INTERVAL, 100);
     fConf.setLong(MRConfig.MAPMEMORY_MB, 2 * 1024);
     fConf.setLong(MRConfig.REDUCEMEMORY_MB, 2 * 1024);
     startCluster(fConf);
@@ -219,6 +225,8 @@ public class TestTaskTrackerMemoryManage
    * 
    * @throws Exception
    */
+  @Ignore("Intermittent, unexpected task success causes test to fail.")
+  @Test
   public void testTasksBeyondPhysicalLimits()
       throws Exception {
 
@@ -230,8 +238,7 @@ public class TestTaskTrackerMemoryManage
     // Start cluster with proper configuration.
     JobConf fConf = new JobConf();
     // very small value, so that no task escapes to successful completion.
-    fConf.set(TTConfig.TT_MEMORY_MANAGER_MONITORING_INTERVAL,
-        String.valueOf(300));
+    fConf.setInt(TTConfig.TT_MEMORY_MANAGER_MONITORING_INTERVAL, 100);
     // Reserve only 1 mb of the memory on TaskTrackers
     fConf.setLong(TTConfig.TT_RESERVED_PHYSCIALMEMORY_MB, 1L);
     startCluster(fConf);
@@ -244,7 +251,8 @@ public class TestTaskTrackerMemoryManage
    * 
    * @throws Exception
    */
-
+  @Ignore("Intermittent, unexpected task success causes test to fail.")
+  @Test
   public void testTaskMemoryMonitoringWithDeprecatedConfiguration () 
     throws Exception {
     
@@ -255,8 +263,7 @@ public class TestTaskTrackerMemoryManage
     // Start cluster with proper configuration.
     JobConf fConf = new JobConf();
     // very small value, so that no task escapes to successful completion.
-    fConf.set(TTConfig.TT_MEMORY_MANAGER_MONITORING_INTERVAL,
-        String.valueOf(300));
+    fConf.setInt(TTConfig.TT_MEMORY_MANAGER_MONITORING_INTERVAL, 100);
     //set old values, max vm property per task and upper limit on the tasks
     //vm
     //setting the default maximum vmem property to 2 GB
@@ -317,14 +324,15 @@ public class TestTaskTrackerMemoryManage
 
     for (TaskCompletionEvent tce : taskComplEvents) {
       // Every task HAS to fail
-      assert (tce.getTaskStatus() == TaskCompletionEvent.Status.TIPFAILED || tce
-          .getTaskStatus() == TaskCompletionEvent.Status.FAILED);
+      assertTrue("Failure expected, task: " + tce.getTaskStatus(),
+          tce.getTaskStatus() == TaskCompletionEvent.Status.TIPFAILED ||
+          tce.getTaskStatus() == TaskCompletionEvent.Status.FAILED);
 
       String[] diagnostics =
           rj.getTaskDiagnostics(tce.getTaskAttemptId());
 
       // Every task HAS to spit out the out-of-memory errors
-      assert (diagnostics != null);
+      assertNotNull(diagnostics);
 
       for (String str : diagnostics) {
         mat = taskOverLimitPattern.matcher(str);
@@ -343,6 +351,7 @@ public class TestTaskTrackerMemoryManage
    * 
    * @throws Exception
    */
+  @Test
   public void testTasksCumulativelyExceedingTTLimits()
       throws Exception {
 
@@ -365,8 +374,7 @@ public class TestTaskTrackerMemoryManage
     long TASK_TRACKER_LIMIT = 2 * 1024 * 1024L;
 
     // very small value, so that no task escapes to successful completion.
-    fConf.set(TTConfig.TT_MEMORY_MANAGER_MONITORING_INTERVAL,
-        String.valueOf(300));
+    fConf.setInt(TTConfig.TT_MEMORY_MANAGER_MONITORING_INTERVAL, 100);
 
     startCluster(fConf);
 
@@ -431,6 +439,7 @@ public class TestTaskTrackerMemoryManage
    * @throws IOException if there was a problem setting up the
    *                      fake procfs directories or files.
    */
+  @Test
   public void testProcessTreeLimits() throws IOException {
     
     // set up a dummy proc file system
@@ -518,6 +527,7 @@ public class TestTaskTrackerMemoryManage
    *
    * @throws Exception
    */
+  @Test
   public void testTasksCumulativelyExceedingTTPhysicalLimits()
       throws Exception {
 
@@ -530,8 +540,7 @@ public class TestTaskTrackerMemoryManage
     JobConf fConf = new JobConf();
 
     // very small value, so that no task escapes to successful completion.
-    fConf.set("mapred.tasktracker.taskmemorymanager.monitoring-interval",
-        String.valueOf(300));
+    fConf.setInt(TTConfig.TT_MEMORY_MANAGER_MONITORING_INTERVAL, 100);
     
     // reserve all memory on TT so that the job will exceed memory limits
     LinuxResourceCalculatorPlugin memoryCalculatorPlugin =



Mime
View raw message