incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: Fixing the test so that the correct counter is used regardless of hadoop1 or hadoop2.
Date Thu, 11 Jun 2015 11:46:13 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/master 13f3414b6 -> ac41db559


Fixing the test so that the correct counter is used regardless of hadoop1 or hadoop2.


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

Branch: refs/heads/master
Commit: ac41db55998f1dbe4d3ed2ef28589d8eba301f15
Parents: 13f3414
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Thu Jun 11 07:46:18 2015 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Thu Jun 11 07:46:18 2015 -0400

----------------------------------------------------------------------
 .../blur/mapreduce/lib/BlurInputFormatTest.java | 27 +++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac41db55/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurInputFormatTest.java
----------------------------------------------------------------------
diff --git a/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurInputFormatTest.java
b/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurInputFormatTest.java
index c60c92c..889d0d9 100644
--- a/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurInputFormatTest.java
+++ b/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurInputFormatTest.java
@@ -18,6 +18,7 @@ package org.apache.blur.mapreduce.lib;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.io.File;
 import java.io.IOException;
@@ -180,9 +181,8 @@ public class BlurInputFormatTest {
     try {
       assertTrue(job.waitForCompletion(true));
       Counters counters = job.getCounters();
-      CounterGroup counterGroup = counters.getGroup("org.apache.hadoop.mapreduce.JobCounter");
-      Counter counter = counterGroup.findCounter("TOTAL_LAUNCHED_MAPS");
-      assertEquals(1, counter.getValue());
+      assertMapTask(1, counters);
+
     } finally {
       client.removeSnapshot(tableName, snapshot);
     }
@@ -211,6 +211,27 @@ public class BlurInputFormatTest {
     assertEquals(200, rowId);
   }
 
+  private void assertMapTask(int i, Counters counters) {
+    for (CounterGroup counterGroup : counters) {
+      String name = counterGroup.getName();
+      boolean jobCounterGroup = false;
+      if (name.equals("org.apache.hadoop.mapreduce.JobCounter")) {
+        jobCounterGroup = true;
+      } else if (name.equals("org.apache.hadoop.mapred.JobInProgress$Counter")) {
+        jobCounterGroup = true;
+      }
+      if (jobCounterGroup) {
+        for (Counter counter : counterGroup) {
+          if (counter.getName().equals("TOTAL_LAUNCHED_MAPS")) {
+            assertEquals(1, counter.getValue());
+            return;
+          }
+        }
+      }
+    }
+    fail();
+  }
+
   public interface ResultReader {
 
     void read(Text rowId, TableBlurRecord tableBlurRecord);


Mime
View raw message