You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by ji...@apache.org on 2021/07/15 22:04:16 UTC
[helix] branch master updated: Stabilize the ZkClient monitor
tests. (#1813)
This is an automated email from the ASF dual-hosted git repository.
jiajunwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git
The following commit(s) were added to refs/heads/master by this push:
new f1bd26f Stabilize the ZkClient monitor tests. (#1813)
f1bd26f is described below
commit f1bd26f51b1be2edc939a344972e60add4728622
Author: Jiajun Wang <jj...@linkedin.com>
AuthorDate: Thu Jul 15 15:04:05 2021 -0700
Stabilize the ZkClient monitor tests. (#1813)
Stabilize the ZkClient monitor tests.
---
.../apache/helix/zookeeper/impl/client/TestRawZkClient.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestRawZkClient.java b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestRawZkClient.java
index 79efd12..20d070b 100644
--- a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestRawZkClient.java
+++ b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestRawZkClient.java
@@ -391,6 +391,10 @@ public class TestRawZkClient extends ZkTestBase {
Assert.assertTrue((long) beanServer.getAttribute(idealStatename, "WriteTotalLatencyCounter")
>= origIdealStatesWriteTotalLatencyCounter);
+ // Verify the callback baseline count because of the data sync call.
+ Assert.assertEquals((long) beanServer.getAttribute(name, "TotalCallbackCounter"), 1);
+ Assert.assertEquals((long) beanServer.getAttribute(name, "TotalCallbackHandledCounter"), 1);
+
// Test data change count
final Lock lock = new ReentrantLock();
final Condition callbackFinish = lock.newCondition();
@@ -415,12 +419,16 @@ public class TestRawZkClient extends ZkTestBase {
}
});
lock.lock();
+
_zkClient.writeData(TEST_PATH, "Test");
Assert.assertTrue(callbackFinish.await(10, TimeUnit.SECONDS));
Assert.assertEquals((long) beanServer.getAttribute(name, "DataChangeEventCounter"), 1);
Assert.assertEquals((long) beanServer.getAttribute(name, "OutstandingRequestGauge"), 0);
Assert.assertEquals((long) beanServer.getAttribute(name, "TotalCallbackCounter"), 2);
- Assert.assertEquals((long) beanServer.getAttribute(name, "TotalCallbackHandledCounter"), 2);
+ // Processing of the event might be slightly delayed.
+ Assert.assertTrue(TestHelper
+ .verify(() -> (long) beanServer.getAttribute(name, "TotalCallbackHandledCounter") == 2,
+ 500));
Assert.assertEquals((long) beanServer.getAttribute(name, "PendingCallbackGauge"), 0);
// Simulate a delayed callback