You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ey...@apache.org on 2012/12/02 01:31:23 UTC
svn commit: r1416087 - in /hadoop/common/branches/branch-1.1: CHANGES.txt
src/test/org/apache/hadoop/mapred/TestJobHistoryServer.java
Author: eyang
Date: Sun Dec 2 00:31:22 2012
New Revision: 1416087
URL: http://svn.apache.org/viewvc?rev=1416087&view=rev
Log:
MAPREDUCE-4798. Updated TestJobHistoryServer test case for startup
race conditions. (Sam Liu via eyang)
Modified:
hadoop/common/branches/branch-1.1/CHANGES.txt
hadoop/common/branches/branch-1.1/src/test/org/apache/hadoop/mapred/TestJobHistoryServer.java
Modified: hadoop/common/branches/branch-1.1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1.1/CHANGES.txt?rev=1416087&r1=1416086&r2=1416087&view=diff
==============================================================================
--- hadoop/common/branches/branch-1.1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1.1/CHANGES.txt Sun Dec 2 00:31:22 2012
@@ -13,6 +13,9 @@ Release 1.1.2 - 2012.11.18
BUG FIXES
+ MAPREDUCE-4798. Updated TestJobHistoryServer test case for startup
+ race conditions. (Sam Liu via eyang)
+
HDFS-3727. When using SPNEGO, NN should not try to log in using KSSL
principal. (atm)
Modified: hadoop/common/branches/branch-1.1/src/test/org/apache/hadoop/mapred/TestJobHistoryServer.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1.1/src/test/org/apache/hadoop/mapred/TestJobHistoryServer.java?rev=1416087&r1=1416086&r2=1416087&view=diff
==============================================================================
--- hadoop/common/branches/branch-1.1/src/test/org/apache/hadoop/mapred/TestJobHistoryServer.java (original)
+++ hadoop/common/branches/branch-1.1/src/test/org/apache/hadoop/mapred/TestJobHistoryServer.java Sun Dec 2 00:31:22 2012
@@ -70,6 +70,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();
}
@@ -109,6 +112,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 {
@@ -148,12 +154,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"));