Github user revans2 commented on a diff in the pull request:
https://github.com/apache/storm/pull/776#discussion_r41022920
--- Diff: storm-core/test/jvm/backtype/storm/utils/RateTrackerTest.java ---
@@ -27,36 +27,63 @@
public class RateTrackerTest extends TestCase {
@Test
+ public void testExactRate() {
+ final long interval = 1000l;
+ long time = 0l;
+ RateTracker rt = new RateTracker(10000, 10, time);
+ double [] expected = new double[] {10.0, 10.0, 10.0, 10.0, 10.0,
10.0, 10.0, 10.0, 10.0, 10.0};
+ for (int i = 0; i < expected.length; i++) {
+ double exp = expected[i];
+ rt.notify(10);
+ time += interval;
+ double actual = rt.reportRate(time);
+ rt.forceRotate(1, interval);
+ assertEquals("Expected rate on iteration "+i+" is wrong.",
exp, actual, 0.00001);
+ }
+ expected = new double[] {11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0,
18.0, 19.0, 20.0};
--- End diff --
Great point I will add this in.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---