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

He-Pin pushed a commit to branch fix/remove-internal-cluster-sharding-data-spec
in repository https://gitbox.apache.org/repos/asf/pekko.git

commit 917420f0e9b61cf8230f8bfddcf3a1cd5308e8e3
Author: He-Pin <[email protected]>
AuthorDate: Fri May 29 23:10:06 2026 +0800

    test: await eventual deletion in RemoveInternalClusterShardingDataSpec
    
    Motivation:
    RemoveInternalClusterShardingDataSpec "must remove all events and snapshots"
    is intermittently flaky (issue #1228), failing with "true did not equal
    false" at the post-removal hasSnapshots/hasEvents assertions. Even though
    RemoveOnePersistenceId has replied with a successful Removals result, a
    fresh read of the snapshot/event store may not observe the deletion
    immediately, so the assertion can still see stale data.
    
    Modification:
    Wrap the post-removal hasSnapshots/hasEvents assertions in awaitAssert so
    they retry until the deletion becomes visible, mirroring the awaitAssert
    already used for the pre-removal snapshot-visibility check.
    
    Result:
    The test tolerates the eventual visibility of deletions; it still passes
    locally.
    
    References:
    Fixes #1228
---
 .../cluster/sharding/RemoveInternalClusterShardingDataSpec.scala   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/RemoveInternalClusterShardingDataSpec.scala
 
b/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/RemoveInternalClusterShardingDataSpec.scala
index 3f28df0261..a6ec3d8b66 100644
--- 
a/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/RemoveInternalClusterShardingDataSpec.scala
+++ 
b/cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/RemoveInternalClusterShardingDataSpec.scala
@@ -190,8 +190,11 @@ class RemoveInternalClusterShardingDataSpec
       watch(rm)
       expectMsg(Result(Success(Removals(events = true, snapshots = true))))
       expectTerminated(rm)
-      hasSnapshots("type2") should ===(false)
-      hasEvents("type2") should ===(false)
+      awaitAssert {
+        // deletion may not be visible to a fresh read immediately after the 
removal completes
+        hasSnapshots("type2") should ===(false)
+        hasEvents("type2") should ===(false)
+      }
     }
   }
 


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

Reply via email to