You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by ad...@apache.org on 2023/02/20 17:32:24 UTC

[ozone] branch master updated: HDDS-7588. Intermittent failure in TestObjectStoreWithLegacyFS#testFlatKeyStructureWithOBS (#4290)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 501152d313 HDDS-7588. Intermittent failure in TestObjectStoreWithLegacyFS#testFlatKeyStructureWithOBS (#4290)
501152d313 is described below

commit 501152d3139a8ca72a2095e6cdf60edfa9340fcf
Author: Kaijie Chen <ck...@apache.org>
AuthorDate: Tue Feb 21 01:32:19 2023 +0800

    HDDS-7588. Intermittent failure in TestObjectStoreWithLegacyFS#testFlatKeyStructureWithOBS (#4290)
---
 .../apache/hadoop/ozone/om/TestObjectStoreWithLegacyFS.java   | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestObjectStoreWithLegacyFS.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestObjectStoreWithLegacyFS.java
index fb10a346e9..c184f45220 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestObjectStoreWithLegacyFS.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestObjectStoreWithLegacyFS.java
@@ -146,6 +146,7 @@ public class TestObjectStoreWithLegacyFS {
       Table<String, OmKeyInfo> keyTable,
       String dbKey, int expectedCnt, String keyName) {
     int countKeys = 0;
+    int matchingKeys = 0;
     try {
       TableIterator<String, ? extends Table.KeyValue<String, OmKeyInfo>>
           itr = keyTable.iterator();
@@ -157,16 +158,20 @@ public class TestObjectStoreWithLegacyFS {
           break;
         }
         countKeys++;
-        Assert.assertTrue(keyValue.getKey().endsWith(keyName));
+        matchingKeys += keyValue.getKey().endsWith(keyName) ? 1 : 0;
       }
     } catch (IOException ex) {
       LOG.info("Test failed with: " + ex.getMessage(), ex);
       Assert.fail("Test failed with: " + ex.getMessage());
     }
-    if (countKeys != expectedCnt) {
+    if (countKeys > expectedCnt) {
+      Assert.fail("Test failed with: too many keys found, expected "
+          + expectedCnt + " keys, found " + countKeys + " keys");
+    }
+    if (matchingKeys != expectedCnt) {
       LOG.info("Couldn't find KeyName:{} in KeyTable, retrying...", keyName);
     }
-    return countKeys == expectedCnt;
+    return countKeys == expectedCnt && matchingKeys == expectedCnt;
   }
 
   @Test


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org