Skip to content

Commit 167dc3e

Browse files
author
Alejandro Abdelnur
committed
MAPREDUCE-4924. flakey test: org.apache.hadoop.mapred.TestClusterMRNotification.testMR. (rkanter via tucu)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1433753 13f79535-47bb-0310-9956-ffa450edef68
1 parent 4060217 commit 167dc3e

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

hadoop-mapreduce-project/CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ Release 2.0.3-alpha - Unreleased
256256
MAPREDUCE-4936. JobImpl uber checks for cpu are wrong (Arun C Murthy via
257257
jlowe)
258258

259+
MAPREDUCE-4924. flakey test: org.apache.hadoop.mapred.TestClusterMRNotification.testMR.
260+
(rkanter via tucu)
261+
259262
Release 2.0.2-alpha - 2012-09-07
260263

261264
INCOMPATIBLE CHANGES

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/NotificationTestCase.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ private void stopHttpServer() throws Exception {
9090
}
9191

9292
public static class NotificationServlet extends HttpServlet {
93-
public static int counter = 0;
94-
public static int failureCounter = 0;
93+
public static volatile int counter = 0;
94+
public static volatile int failureCounter = 0;
9595
private static final long serialVersionUID = 1L;
9696

9797
protected void doGet(HttpServletRequest req, HttpServletResponse res)
@@ -155,7 +155,11 @@ public void testMR() throws Exception {
155155

156156
System.out.println(launchWordCount(this.createJobConf(),
157157
"a b c d e f g h", 1, 1));
158-
Thread.sleep(2000);
158+
boolean keepTrying = true;
159+
for (int tries = 0; tries < 30 && keepTrying; tries++) {
160+
Thread.sleep(50);
161+
keepTrying = !(NotificationServlet.counter == 2);
162+
}
159163
assertEquals(2, NotificationServlet.counter);
160164
assertEquals(0, NotificationServlet.failureCounter);
161165

@@ -173,14 +177,22 @@ public void testMR() throws Exception {
173177
// run a job with KILLED status
174178
System.out.println(UtilsForTests.runJobKill(this.createJobConf(), inDir,
175179
outDir).getID());
176-
Thread.sleep(2000);
180+
keepTrying = true;
181+
for (int tries = 0; tries < 30 && keepTrying; tries++) {
182+
Thread.sleep(50);
183+
keepTrying = !(NotificationServlet.counter == 4);
184+
}
177185
assertEquals(4, NotificationServlet.counter);
178186
assertEquals(0, NotificationServlet.failureCounter);
179187

180188
// run a job with FAILED status
181189
System.out.println(UtilsForTests.runJobFail(this.createJobConf(), inDir,
182190
outDir).getID());
183-
Thread.sleep(2000);
191+
keepTrying = true;
192+
for (int tries = 0; tries < 30 && keepTrying; tries++) {
193+
Thread.sleep(50);
194+
keepTrying = !(NotificationServlet.counter == 6);
195+
}
184196
assertEquals(6, NotificationServlet.counter);
185197
assertEquals(0, NotificationServlet.failureCounter);
186198
}

0 commit comments

Comments
 (0)