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

He-Pin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko.git


The following commit(s) were added to refs/heads/main by this push:
     new 0729960f28 test: await eventual deletion in 
RemoveInternalClusterShardingDataSpec (#3013)
0729960f28 is described below

commit 0729960f28ac3ad28a567b3247182315cf94b81d
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Sat May 30 00:14:57 2026 +0800

    test: await eventual deletion in RemoveInternalClusterShardingDataSpec 
(#3013)
    
    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