hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ey...@apache.org
Subject svn commit: r1416089 - in /hadoop/common/branches/branch-1.0: CHANGES.txt src/test/org/apache/hadoop/mapred/TestJobHistoryServer.java
Date Sun, 02 Dec 2012 00:33:00 GMT
Author: eyang
Date: Sun Dec  2 00:32:59 2012
New Revision: 1416089

URL: http://svn.apache.org/viewvc?rev=1416089&view=rev
Log:
MAPREDUCE-4798. Updated TestJobHistoryServer test case for startup
race conditions.  (Sam Liu via eyang)

Modified:
    hadoop/common/branches/branch-1.0/CHANGES.txt
    hadoop/common/branches/branch-1.0/src/test/org/apache/hadoop/mapred/TestJobHistoryServer.java

Modified: hadoop/common/branches/branch-1.0/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1.0/CHANGES.txt?rev=1416089&r1=1416088&r2=1416089&view=diff
==============================================================================
--- hadoop/common/branches/branch-1.0/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1.0/CHANGES.txt Sun Dec  2 00:32:59 2012
@@ -1,5 +1,16 @@
 Hadoop Change Log
 
+Release 1.0.5 - unreleased
+
+  NEW FEATURES
+
+  IMPROVEMENTS
+
+  BUG FIXES
+
+    MAPREDUCE-4798. Updated TestJobHistoryServer test case for startup
+    race conditions.  (Sam Liu via eyang)
+
 Release 1.0.4 - 2012.10.02
 
   NEW FEATURES

Modified: hadoop/common/branches/branch-1.0/src/test/org/apache/hadoop/mapred/TestJobHistoryServer.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1.0/src/test/org/apache/hadoop/mapred/TestJobHistoryServer.java?rev=1416089&r1=1416088&r2=1416089&view=diff
==============================================================================
--- hadoop/common/branches/branch-1.0/src/test/org/apache/hadoop/mapred/TestJobHistoryServer.java
(original)
+++ hadoop/common/branches/branch-1.0/src/test/org/apache/hadoop/mapred/TestJobHistoryServer.java
Sun Dec  2 00:32:59 2012
@@ -72,6 +72,9 @@ public class TestJobHistoryServer extend
     } catch (IOException e) {
       LOG.error("Failure running test", e);
       Assert.fail(e.getMessage());
+    } catch (InterruptedException e) {
+      LOG.error("Exit due to being interrupted");
+      Assert.fail(e.getMessage());
     } finally {
       if (mrCluster != null) mrCluster.shutdown();
     }
@@ -111,6 +114,9 @@ public class TestJobHistoryServer extend
     } catch (IOException e) {
       LOG.error("Failure running test", e);
       Assert.fail(e.getMessage());
+    } catch (InterruptedException e) {
+      LOG.error("Exit due to being interrupted");
+      Assert.fail(e.getMessage());
     } finally {
       if (mrCluster != null) mrCluster.shutdown();
       try {
@@ -150,12 +156,28 @@ public class TestJobHistoryServer extend
     return JobClient.runJob(conf);
   }
 
-  private String getRedirectUrl(String jobUrl) throws IOException {
+  private String getRedirectUrl(String jobUrl) throws IOException, InterruptedException {
     HttpClient client = new HttpClient();
     GetMethod method = new GetMethod(jobUrl);
     method.setFollowRedirects(false);
     try {
       int status = client.executeMethod(method);
+      if(status!=HttpURLConnection.HTTP_MOVED_TEMP) {
+        int retryTimes = 4;
+        for(int i = 1; i < retryTimes + 1; i++) {
+          try {
+            // Wait i sec
+            Thread.sleep(i * 1000);
+          } catch (InterruptedException e) {
+            throw new InterruptedException("Exit due to being interrupted");
+          }
+          // Get the latest status
+          status = client.executeMethod(method);
+          if(status == HttpURLConnection.HTTP_MOVED_TEMP)
+            break;
+        }
+      }
+
       Assert.assertEquals(status, HttpURLConnection.HTTP_MOVED_TEMP);
 
       LOG.info("Location: " + method.getResponseHeader("Location"));



Mime
View raw message