This is an automated email from the ASF dual-hosted git repository.

anmolnar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new b1d1f4794 ZOOKEEPER-5080: Fix flaky metric assertion in 
SnapshotAndRestoreCommandTest
b1d1f4794 is described below

commit b1d1f47948de8b4e0de0f8f7e5efb4a311838353
Author: xeno <[email protected]>
AuthorDate: Tue Aug 25 20:21:05 2026 +0200

    ZOOKEEPER-5080: Fix flaky metric assertion in SnapshotAndRestoreCommandTest
    
    Reviewers: uros-b, anmolnar
    Author: IvanKhanas
    Closes #2442 from IvanKhanas/ZOOKEEPER-5080
---
 .../apache/zookeeper/server/admin/SnapshotAndRestoreCommandTest.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/zookeeper-server/src/test/java/org/apache/zookeeper/server/admin/SnapshotAndRestoreCommandTest.java
 
b/zookeeper-server/src/test/java/org/apache/zookeeper/server/admin/SnapshotAndRestoreCommandTest.java
index e8aaa22f8..6fb89ba46 100644
--- 
a/zookeeper-server/src/test/java/org/apache/zookeeper/server/admin/SnapshotAndRestoreCommandTest.java
+++ 
b/zookeeper-server/src/test/java/org/apache/zookeeper/server/admin/SnapshotAndRestoreCommandTest.java
@@ -395,14 +395,14 @@ private void validateSnapshotMetrics() {
         Map<String, Object> metrics = MetricsUtils.currentServerMetrics();
         assertEquals(0, (long) metrics.get("snapshot_error_count"));
         assertEquals(0, (long) metrics.get("snapshot_rate_limited_count"));
-        assertTrue((Double) metrics.get("avg_snapshottime") > 0.0);
+        assertEquals(1L, (long) metrics.get("cnt_snapshottime"));
     }
 
     private void validateRestoreMetrics() {
         Map<String, Object> metrics = MetricsUtils.currentServerMetrics();
         assertEquals(0, (long) metrics.get("restore_error_count"));
         assertEquals(0, (long) metrics.get("restore_rate_limited_count"));
-        assertTrue((Double) metrics.get("avg_restore_time") > 0.0);
+        assertEquals(1L, (long) metrics.get("cnt_restore_time"));
     }
 
     public static  File takeSnapshotAndValidate(final int jettyAdminPort, 
final File dataDir) throws Exception {

Reply via email to