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

pjfanning 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 2e27a47f62 test: cover propagate-harmless-quarantine-events = on 
(#3637)
2e27a47f62 is described below

commit 2e27a47f622e6df68272519861d9b1303364d866
Author: PJ Fanning <[email protected]>
AuthorDate: Tue Oct 20 06:23:59 2026 +0100

    test: cover propagate-harmless-quarantine-events = on (#3637)
    
    Motivation:
    `pekko.remote.artery.propagate-harmless-quarantine-events` lets users 
restore
    the Pekko 1.x behaviour of propagating harmless quarantine events, but only
    the default (off) was covered by tests.
    
    Modification:
    Turn HarmlessQuarantineSpec into an abstract spec parameterised by extra
    config, keep HarmlessQuarantineSpec on the default settings, and add
    HarmlessQuarantinePropagationSpec with the setting on. With the setting on,
    a harmless quarantine is expected to notify the remote system
    (ThisActorSystemQuarantinedEvent); with it off, no notification is expected.
    
    Result:
    Both settings of propagate-harmless-quarantine-events are covered.
    
    Tests:
    - sbt "remote/testOnly 
org.apache.pekko.remote.artery.HarmlessQuarantineSpec 
org.apache.pekko.remote.artery.HarmlessQuarantinePropagationSpec": 4 succeeded, 
0 failed
    
    References:
    Refs #1555
---
 .../remote/artery/HarmlessQuarantineSpec.scala     | 25 ++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git 
a/remote/src/test/scala/org/apache/pekko/remote/artery/HarmlessQuarantineSpec.scala
 
b/remote/src/test/scala/org/apache/pekko/remote/artery/HarmlessQuarantineSpec.scala
index 05770d2bd1..7864277c78 100644
--- 
a/remote/src/test/scala/org/apache/pekko/remote/artery/HarmlessQuarantineSpec.scala
+++ 
b/remote/src/test/scala/org/apache/pekko/remote/artery/HarmlessQuarantineSpec.scala
@@ -31,7 +31,13 @@ import org.scalatest.concurrent.Eventually
 import org.scalatest.time.Span
 
 // pekko.remote.artery.propagate-harmless-quarantine-events defaults to off 
since Pekko 2.0.0
-class HarmlessQuarantineSpec extends ArteryMultiNodeSpec("""
+class HarmlessQuarantineSpec extends AbstractHarmlessQuarantineSpec("")
+
+// legacy Pekko 1.x behavior: harmless quarantine events are propagated to the 
remote system
+class HarmlessQuarantinePropagationSpec
+    extends 
AbstractHarmlessQuarantineSpec("pekko.remote.artery.propagate-harmless-quarantine-events
 = on")
+
+abstract class AbstractHarmlessQuarantineSpec(extraConfig: String) extends 
ArteryMultiNodeSpec(s"""
   pekko.loglevel=INFO
   pekko.remote.artery.advanced {
     stop-idle-outbound-after = 1 s
@@ -41,8 +47,12 @@ class HarmlessQuarantineSpec extends ArteryMultiNodeSpec("""
       actor-refs.advertisement-interval = 5 seconds
     }
   }
+  $extraConfig
   """) with ImplicitSender with Eventually {
 
+  private val propagateHarmlessQuarantineEvents =
+    
system.settings.config.getBoolean("pekko.remote.artery.propagate-harmless-quarantine-events")
+
   override implicit val patience: PatienceConfig = {
     import pekko.testkit.TestDuration
     PatienceConfig(testKitSettings.DefaultTimeout.duration.dilated * 2, 
Span(200, org.scalatest.time.Millis))
@@ -104,9 +114,16 @@ class HarmlessQuarantineSpec extends 
ArteryMultiNodeSpec("""
         association.associationState.isQuarantined(remoteUid) shouldBe true
         association.associationState.quarantinedButHarmless(remoteUid) 
shouldBe true
 
-        remoteEcho.tell("ping", localEchoRef) // trigger sending message from 
remote to local, which will trigger local to wrongfully notify remote that it 
is quarantined
-        eventually {
-          expectNoMessage()
+        remoteEcho.tell("ping", localEchoRef) // trigger sending message from 
remote to local
+        if (propagateHarmlessQuarantineEvents) {
+          // legacy behavior: local notifies remote that it is quarantined, 
even though the quarantine is harmless
+          eventually {
+            expectMsgType[ThisActorSystemQuarantinedEvent]
+          }
+        } else {
+          eventually {
+            expectNoMessage()
+          }
         }
     }
 


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

Reply via email to