-
Type:
Bug
-
Status: Closed
-
Priority:
Trivial
-
Resolution: Fixed
-
Affects Version/s: 2.0.2-alpha
-
Fix Version/s: 1.2.0, 2.0.3-alpha
-
Component/s: mrv1
-
Labels:None
-
Hadoop Flags:Reviewed
I occasionally get a failure like this on org.apache.hadoop.mapred.TestClusterMRNotification.testMR
junit.framework.AssertionFailedError: expected:<6> but was:<4> at junit.framework.Assert.fail(Assert.java:47) at junit.framework.Assert.failNotEquals(Assert.java:283) at junit.framework.Assert.assertEquals(Assert.java:64) at junit.framework.Assert.assertEquals(Assert.java:195) at junit.framework.Assert.assertEquals(Assert.java:201) at org.apache.hadoop.mapred.NotificationTestCase.testMR(NotificationTestCase.java:184) ...
It looks like a race condition:
// run a job with FAILED status System.out.println(UtilsForTests.runJobFail(this.createJobConf(), inDir, outDir).getID()); Thread.sleep(2000); assertEquals(6, NotificationServlet.counter); assertEquals(0, NotificationServlet.failureCounter);
Instead of sleeping for 2 seconds, we should keep checking the counter and fail after a timeout. There's a couple of similar places in the test that should be fixed too.