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

hepin 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 292e4cf665 Fix EventSourcedBehaviorRetentionSpec non-determinism 
(#2803)
292e4cf665 is described below

commit 292e4cf6653964e4221dea4518427ce817abf901
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Mon Mar 30 20:17:53 2026 +0800

    Fix EventSourcedBehaviorRetentionSpec non-determinism (#2803)
    
    Split the second batch of 10 increments into smaller batches (3+3+4)
    with intermediate assertions after each batch. This ensures snapshot
    and delete signals are observed in the expected order, preventing
    flaky test failures caused by interleaving of async operations.
    
    Upstream: akka/akka-core@f38f8cce11
    Cherry-picked from akka/akka-core v2.8.0, which is now Apache licensed.
---
 .../typed/scaladsl/EventSourcedBehaviorRetentionSpec.scala   | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorRetentionSpec.scala
 
b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorRetentionSpec.scala
index cde99abe1b..9972cd77c9 100644
--- 
a/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorRetentionSpec.scala
+++ 
b/persistence-typed-tests/src/test/scala/org/apache/pekko/persistence/typed/scaladsl/EventSourcedBehaviorRetentionSpec.scala
@@ -286,13 +286,21 @@ class EventSourcedBehaviorRetentionSpec
       snapshotSignalProbe.expectSnapshotCompleted(9)
       snapshotSignalProbe.expectDeleteSnapshotCompleted(3, 0)
 
-      (1 to 10).foreach(_ => persistentActor ! Increment)
+      (1 to 3).foreach(_ => persistentActor ! Increment)
       persistentActor ! GetValue(replyProbe.ref)
-      replyProbe.expectMessage(State(20, (0 until 20).toVector))
+      replyProbe.expectMessage(State(13, (0 until 13).toVector))
       snapshotSignalProbe.expectSnapshotCompleted(12)
       snapshotSignalProbe.expectDeleteSnapshotCompleted(6, 0)
+
+      (1 to 3).foreach(_ => persistentActor ! Increment)
+      persistentActor ! GetValue(replyProbe.ref)
+      replyProbe.expectMessage(State(16, (0 until 16).toVector))
       snapshotSignalProbe.expectSnapshotCompleted(15)
       snapshotSignalProbe.expectDeleteSnapshotCompleted(9, 3)
+
+      (1 to 4).foreach(_ => persistentActor ! Increment)
+      persistentActor ! GetValue(replyProbe.ref)
+      replyProbe.expectMessage(State(20, (0 until 20).toVector))
       snapshotSignalProbe.expectSnapshotCompleted(18)
       snapshotSignalProbe.expectDeleteSnapshotCompleted(12, 6)
 


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

Reply via email to