From b820b776865a72b95335202b696104d40675b7e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=99=8E=E9=B8=A3?= Date: Sat, 11 Jul 2026 04:20:50 +0800 Subject: [PATCH] test: make classic remoting handoff assertion eventual Motivation: The passive read handoff spec observes handle disassociation before the original reader has necessarily processed ResumeReading, making its single verification message timing-dependent. Modification: Retry the verification message with awaitAssert and a bounded per-attempt timeout until the outbound reader resumes. Result: The regression test still fails when reader recovery never happens while tolerating the expected cross-actor handoff delay. Tests: - JDK 17, Scala 3.8.4 focused RemotingSpec test: passed - JDK 17, Scala 3.8.4 full RemotingSpec: 22 passed - JDK 17, Scala 2.13.18 focused RemotingSpec test: passed - sbt headerCreateAll +headerCheckAll: passed - scalafmt --list --mode diff-ref=origin/main: passed - git diff --check: passed References: Refs #3205 --- .../org/apache/pekko/remote/classic/RemotingSpec.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/remote/src/test/scala/org/apache/pekko/remote/classic/RemotingSpec.scala b/remote/src/test/scala/org/apache/pekko/remote/classic/RemotingSpec.scala index cbed60cd92..ae79f265c6 100644 --- a/remote/src/test/scala/org/apache/pekko/remote/classic/RemotingSpec.scala +++ b/remote/src/test/scala/org/apache/pekko/remote/classic/RemotingSpec.scala @@ -793,8 +793,12 @@ class RemotingSpec extends PekkoSpec(RemotingSpec.cfg) with ImplicitSender with case _ => false } - outboundRemoteHandle.association.write(payload("after-handoff-failure")) - receiverProbe.expectMsg("after-handoff-failure") + // The read-only handle disassociation and resuming the outbound reader are handled by different actors. + // Retry until the outbound reader has processed ResumeReading. + awaitAssert { + outboundRemoteHandle.association.write(payload("after-handoff-failure")) + receiverProbe.expectMsg(500.millis, "after-handoff-failure") + } } finally shutdown(thisSystem) }