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

zhangyv pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/incubator-seata.git


The following commit(s) were added to refs/heads/2.x by this push:
     new 2495548c67 test: fix flaky DataCompareUtilsTest caused by 
nondeterministic Map key iteration order (#7803)
2495548c67 is described below

commit 2495548c670730b25b2539203ab4fdb3f96764f1
Author: Xiaoyang Cai <[email protected]>
AuthorDate: Sun Nov 23 07:49:11 2025 -0600

    test: fix flaky DataCompareUtilsTest caused by nondeterministic Map key 
iteration order (#7803)
---
 changes/en-us/2.x.md                                                  | 1 +
 changes/zh-cn/2.x.md                                                  | 1 +
 .../java/org/apache/seata/rm/datasource/DataCompareUtilsTest.java     | 4 ++--
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md
index d8c4431a83..2fed9bd76d 100644
--- a/changes/en-us/2.x.md
+++ b/changes/en-us/2.x.md
@@ -116,6 +116,7 @@ Add changes here for all PR submitted to the 2.x branch.
 - [[#7733](https://github.com/apache/incubator-seata/pull/7733)] add some UT 
for core module
 - [[#7728](https://github.com/apache/incubator-seata/pull/7728)] add some UT 
for compatible module
 - [[#7727](https://github.com/apache/incubator-seata/pull/7727)] add some UT 
for compatible module
+- [[#7803](https://github.com/apache/incubator-seata/pull/7803)] Fix flakiness 
in `DataCompareUtilsTest` caused by non-deterministic Map key iteration order.
 - [[#7804](https://github.com/apache/incubator-seata/pull/7804)] fix 
testXARollbackWithResourceLock() to ensure ci runs normally
 
 
diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md
index f8acfd59d0..6c0efa0a80 100644
--- a/changes/zh-cn/2.x.md
+++ b/changes/zh-cn/2.x.md
@@ -115,6 +115,7 @@
 - [[#7733](https://github.com/apache/incubator-seata/pull/7733)] 为 core 模块添加单测
 - [[#7728](https://github.com/apache/incubator-seata/pull/7728)] 为 compatible 
模块添加单测
 - [[#7727](https://github.com/apache/incubator-seata/pull/7727)] 为 compatible 
模块添加单测
+- [[#7803](https://github.com/apache/incubator-seata/pull/7803)] 修复 
`DataCompareUtilsTest` 中因键迭代顺序不稳定导致的测试用例间歇性失败问题。
 - [[#7804](https://github.com/apache/incubator-seata/pull/7804)] 修复 
testXARollbackWithResourceLock() 以确保 CI 正常运行
 
 
diff --git 
a/rm-datasource/src/test/java/org/apache/seata/rm/datasource/DataCompareUtilsTest.java
 
b/rm-datasource/src/test/java/org/apache/seata/rm/datasource/DataCompareUtilsTest.java
index c62f977053..2abac34451 100644
--- 
a/rm-datasource/src/test/java/org/apache/seata/rm/datasource/DataCompareUtilsTest.java
+++ 
b/rm-datasource/src/test/java/org/apache/seata/rm/datasource/DataCompareUtilsTest.java
@@ -194,7 +194,7 @@ public class DataCompareUtilsTest {
 
         Map<String, Map<String, Field>> result = 
DataCompareUtils.rowListToMap(rows, primaryKeyList);
         Assertions.assertEquals(3, result.size());
-        Assertions.assertEquals(result.keySet().iterator().next(), "1");
+        Assertions.assertTrue(result.containsKey("1"), "Map should contain key 
'1'");
     }
 
     @Test
@@ -227,6 +227,6 @@ public class DataCompareUtilsTest {
 
         Map<String, Map<String, Field>> result = 
DataCompareUtils.rowListToMap(rows, primaryKeyList);
         Assertions.assertEquals(3, result.size());
-        Assertions.assertEquals(result.keySet().iterator().next(), "1_2");
+        Assertions.assertTrue(result.containsKey("1_2"), "Map should contain 
key '1_2'");
     }
 }


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

Reply via email to