You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@edgent.apache.org by dl...@apache.org on 2017/11/02 03:21:31 UTC

[20/50] [abbrv] incubator-edgent git commit: desensitize WindowTest.timeBatchEnsureUnique

desensitize WindowTest.timeBatchEnsureUnique

got a: Number of batches expected:<3> but was:<4>

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

Branch: refs/heads/develop
Commit: 2428f6f6839de2edb9ea204e2ca0b92562083a61
Parents: bea8576
Author: Dale LaBossiere <dl...@us.ibm.com>
Authored: Thu Oct 26 13:18:24 2017 -0400
Committer: Dale LaBossiere <dl...@us.ibm.com>
Committed: Thu Oct 26 13:18:24 2017 -0400

----------------------------------------------------------------------
 .../test/java/org/apache/edgent/test/window/WindowTest.java  | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/2428f6f6/api/window/src/test/java/org/apache/edgent/test/window/WindowTest.java
----------------------------------------------------------------------
diff --git a/api/window/src/test/java/org/apache/edgent/test/window/WindowTest.java b/api/window/src/test/java/org/apache/edgent/test/window/WindowTest.java
index e563d38..ca2863d 100644
--- a/api/window/src/test/java/org/apache/edgent/test/window/WindowTest.java
+++ b/api/window/src/test/java/org/apache/edgent/test/window/WindowTest.java
@@ -487,6 +487,8 @@ public class WindowTest {
         numTuples += batches.get(batches.size() -1).size();
         assertEquals("Number of batch tuples", count.get(), numTuples);
         assertEquals("Number of batches", MAX_TUP_CNT/100, batches.size());
+        assertTrue("Number of batches exp:"+MAX_TUP_CNT/100+" got:"+batches.size(),
+                withinToleranceAmt((double)MAX_TUP_CNT/100, (double)batches.size(), 1)); // +/- 1
     }
     
     private void assertOnTimeEvictions(List<Long> diffs) {
@@ -503,4 +505,10 @@ public class WindowTest {
         return (actual < highBound && actual > lowBound);
     }
 
+    public static boolean withinToleranceAmt(double expected, Double actual, double toleranceAmt) {
+        double lowBound = expected - toleranceAmt;
+        double highBound = expected + toleranceAmt;
+        return (actual < highBound && actual > lowBound);
+    }
+
 }