From 5d47a4ea40e4989841738178952025320cd1c30d Mon Sep 17 00:00:00 2001 From: Damien Diederen Date: Wed, 17 Feb 2021 20:18:55 +0100 Subject: [PATCH] ZOOKEEPER-4200: Widen latency window in WatcherCleanerTest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `WatcherCleanerTest` performs latency checks which fail when outside of a 20+Xms window. Before this patch, X was 5ms—whereas 30+ms is frequently seen on an i5 Mac Mini running macOS Catalina. This "dumb" patch just widens the window to 20ms, which makes it "work on my machine," but could obviously still fail in a loaded environment or VM. Author: Damien Diederen Reviewers: Enrico Olivelli , Mate Szalay-Beko Closes #1592 from ztzg/ZOOKEEPER-4200-widen-latency-window --- .../zookeeper/server/watch/WatcherCleanerTest.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/zookeeper-server/src/test/java/org/apache/zookeeper/server/watch/WatcherCleanerTest.java b/zookeeper-server/src/test/java/org/apache/zookeeper/server/watch/WatcherCleanerTest.java index ec05f14dbde..9ed145aa38d 100644 --- a/zookeeper-server/src/test/java/org/apache/zookeeper/server/watch/WatcherCleanerTest.java +++ b/zookeeper-server/src/test/java/org/apache/zookeeper/server/watch/WatcherCleanerTest.java @@ -162,13 +162,13 @@ public void testDeadWatcherMetrics() { assertEquals(3L, values.get("cnt_dead_watchers_cleaner_latency")); - //Each latency should be a little over 20 ms, allow 5 ms deviation - assertEquals(20D, (Double) values.get("avg_dead_watchers_cleaner_latency"), 5); - assertEquals(20D, ((Long) values.get("min_dead_watchers_cleaner_latency")).doubleValue(), 5); - assertEquals(20D, ((Long) values.get("max_dead_watchers_cleaner_latency")).doubleValue(), 5); - assertEquals(20D, ((Long) values.get("p50_dead_watchers_cleaner_latency")).doubleValue(), 5); - assertEquals(20D, ((Long) values.get("p95_dead_watchers_cleaner_latency")).doubleValue(), 5); - assertEquals(20D, ((Long) values.get("p99_dead_watchers_cleaner_latency")).doubleValue(), 5); + //Each latency should be a little over 20 ms, allow 20 ms deviation + assertEquals(20D, (Double) values.get("avg_dead_watchers_cleaner_latency"), 20); + assertEquals(20D, ((Long) values.get("min_dead_watchers_cleaner_latency")).doubleValue(), 20); + assertEquals(20D, ((Long) values.get("max_dead_watchers_cleaner_latency")).doubleValue(), 20); + assertEquals(20D, ((Long) values.get("p50_dead_watchers_cleaner_latency")).doubleValue(), 20); + assertEquals(20D, ((Long) values.get("p95_dead_watchers_cleaner_latency")).doubleValue(), 20); + assertEquals(20D, ((Long) values.get("p99_dead_watchers_cleaner_latency")).doubleValue(), 20); } }