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

ashvin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-xtable.git


The following commit(s) were added to refs/heads/main by this push:
     new fc1ba78a Fix flaky test, ignore order of elements in list validation
fc1ba78a is described below

commit fc1ba78a3c1836d7eebeaafed23c9bbc2f108a74
Author: Ashvin Agrawal <ash...@apache.org>
AuthorDate: Wed Mar 5 16:21:19 2025 -0800

    Fix flaky test, ignore order of elements in list validation
---
 .../apache/xtable/hudi/TestBaseFileUpdatesExtractor.java    | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git 
a/xtable-core/src/test/java/org/apache/xtable/hudi/TestBaseFileUpdatesExtractor.java
 
b/xtable-core/src/test/java/org/apache/xtable/hudi/TestBaseFileUpdatesExtractor.java
index 4958714c..5695319a 100644
--- 
a/xtable-core/src/test/java/org/apache/xtable/hudi/TestBaseFileUpdatesExtractor.java
+++ 
b/xtable-core/src/test/java/org/apache/xtable/hudi/TestBaseFileUpdatesExtractor.java
@@ -28,6 +28,7 @@ import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
@@ -135,7 +136,7 @@ public class TestBaseFileUpdatesExtractor {
     expectedPartitionToReplacedFileIds.put(
         partitionPath1, Arrays.asList(fileName3, fileIdForFile4));
     expectedPartitionToReplacedFileIds.put(partitionPath2, 
Collections.singletonList(fileName5));
-    assertEquals(
+    assertEqualsIgnoreOrder(
         expectedPartitionToReplacedFileIds, 
replaceMetadata.getPartitionToReplacedFileIds());
 
     // validate added files
@@ -146,6 +147,16 @@ public class TestBaseFileUpdatesExtractor {
     assertWriteStatusesEquivalent(expectedWriteStatuses, 
replaceMetadata.getWriteStatuses());
   }
 
+  private void assertEqualsIgnoreOrder(
+      Map<String, List<String>> expected, Map<String, List<String>> actual) {
+    for (Map.Entry<String, List<String>> entry : expected.entrySet()) {
+      List<?> expectedList = entry.getValue();
+      List<?> actualList = actual.get(entry.getKey());
+      assertEquals(expectedList.size(), actualList.size());
+      assertEquals(new HashSet<>(expectedList), new HashSet<>(actualList));
+    }
+  }
+
   @Test
   void extractSnapshotChanges_emptyTargetTable() throws IOException {
     String tableBasePath = 
tempDir.resolve(UUID.randomUUID().toString()).toString();

Reply via email to