# Minor fix to a flaky Hadoop test.

Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2b98d686
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2b98d686
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2b98d686

Branch: refs/heads/ignite-release-test-no-mod
Commit: 2b98d686390df946cb231af30286c09ed7474d69
Parents: 7a7cc17
Author: vozerov-gridgain <voze...@gridgain.com>
Authored: Mon Mar 23 10:40:37 2015 +0300
Committer: vozerov-gridgain <voze...@gridgain.com>
Committed: Mon Mar 23 10:40:37 2015 +0300

----------------------------------------------------------------------
 .../processors/hadoop/HadoopMapReduceTest.java  | 24 +++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2b98d686/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReduceTest.java
----------------------------------------------------------------------
diff --git 
a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReduceTest.java
 
b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReduceTest.java
index 6242ecc..8a3a0ac 100644
--- 
a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReduceTest.java
+++ 
b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReduceTest.java
@@ -184,14 +184,32 @@ public class HadoopMapReduceTest extends 
HadoopAbstractWordCountTest {
 
         final IgfsPath statPath = new IgfsPath("/xxx/yyy/zzz/" + jobId + 
"/performance");
 
-        GridTestUtils.waitForCondition(new GridAbsPredicate() {
+        assert GridTestUtils.waitForCondition(new GridAbsPredicate() {
             @Override public boolean apply() {
                 return igfs.exists(statPath);
             }
         }, 10000);
 
-        BufferedReader reader = new BufferedReader(new 
InputStreamReader(igfs.open(statPath)));
+        final long apiEvtCnt0 = apiEvtCnt;
 
-        assertEquals(apiEvtCnt, 
HadoopTestUtils.simpleCheckJobStatFile(reader));
+        boolean res = GridTestUtils.waitForCondition(new GridAbsPredicate() {
+            @Override public boolean apply() {
+                try {
+                    try (BufferedReader reader = new BufferedReader(new 
InputStreamReader(igfs.open(statPath)))) {
+                        return apiEvtCnt0 == 
HadoopTestUtils.simpleCheckJobStatFile(reader);
+                    }
+                }
+                catch (IOException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }, 10000);
+
+        if (!res) {
+            BufferedReader reader = new BufferedReader(new 
InputStreamReader(igfs.open(statPath)));
+
+            assert false : "Invalid API events count [exp=" + apiEvtCnt0 +
+                ", actual=" + HadoopTestUtils.simpleCheckJobStatFile(reader) + 
']';
+        }
     }
 }

Reply via email to