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

ckj pushed a commit to branch ozone-1.3
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/ozone-1.3 by this push:
     new 4789acc139 HDDS-7534. Intermittent failure in 
TestKeyDeletingService#checkDeletionForEmptyKey (#3998)
4789acc139 is described below

commit 4789acc139fbad20eb73223c3791efb4a984f64c
Author: Nibiru <[email protected]>
AuthorDate: Fri Nov 25 00:55:52 2022 +0800

    HDDS-7534. Intermittent failure in 
TestKeyDeletingService#checkDeletionForEmptyKey (#3998)
---
 .../ozone/om/service/TestKeyDeletingService.java      | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git 
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyDeletingService.java
 
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyDeletingService.java
index 3bc35c8b3b..9bfa574cfa 100644
--- 
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyDeletingService.java
+++ 
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyDeletingService.java
@@ -208,8 +208,23 @@ public class TestKeyDeletingService {
         (KeyDeletingService) keyManager.getDeletingService();
 
     // the pre-allocated blocks are not committed, hence they will be deleted.
-    Assert.assertEquals(100,
-        keyManager.getPendingDeletionKeys(Integer.MAX_VALUE).size());
+    GenericTestUtils.waitFor(
+        () -> {
+          try {
+            int numPendingDeletionKeys =
+                keyManager.getPendingDeletionKeys(Integer.MAX_VALUE).size();
+            if (numPendingDeletionKeys != keyCount) {
+              LOG.info("Expected {} keys to be pending deletion, but got {}",
+                  keyCount, numPendingDeletionKeys);
+              return false;
+            }
+            return true;
+          } catch (IOException e) {
+            LOG.error("Error while getting pending deletion keys.", e);
+            return false;
+          }
+        }, 100, 2000);
+
     // Make sure that we have run the background thread 2 times or more
     GenericTestUtils.waitFor(
         () -> keyDeletingService.getRunCount().get() >= 2,


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to