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 e482f186cd test: shut down cluster test systems in reverse order
(#2997)
e482f186cd is described below
commit e482f186cde5858c971e74004c6596f30466cd5f
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Wed May 27 19:49:36 2026 +0800
test: shut down cluster test systems in reverse order (#2997)
Motivation:
MixedProtocolClusterSpec nightly runs can pass their cluster join
assertions but still fail when shutdownAll stops the first seed ActorSystem
before the joining nodes have left. On JDK 25 virtualized dispatcher runs this
can leave remoting shutdown waiting until the actor-system-terminate phase
times out.
Modification:
Shut down ClusterTestKit actor systems in reverse registration order so
joining nodes leave first while the seed is still available.
Result:
Multi-ActorSystem cluster specs using shutdownAll keep the seed alive until
the dependent nodes have terminated, reducing shutdown timeout flakiness
without reducing test coverage.
Tests:
- JDK 25 nightly-style: sbt "cluster / Test / testOnly
org.apache.pekko.cluster.MixedProtocolClusterSpec" - 9 tests succeeded / 0
failed
- scalafmt --mode diff-ref=origin/main
- scalafmt --list --mode diff-ref=origin/main
- git diff --check
References:
None - nightly-builds.yml MixedProtocolClusterSpec shutdown timeout
---
cluster/src/test/scala/org/apache/pekko/cluster/ClusterTestKit.scala | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git
a/cluster/src/test/scala/org/apache/pekko/cluster/ClusterTestKit.scala
b/cluster/src/test/scala/org/apache/pekko/cluster/ClusterTestKit.scala
index b3aafde706..1166c866fa 100644
--- a/cluster/src/test/scala/org/apache/pekko/cluster/ClusterTestKit.scala
+++ b/cluster/src/test/scala/org/apache/pekko/cluster/ClusterTestKit.scala
@@ -109,8 +109,11 @@ trait ClusterTestKit extends TestKitBase {
actorSystems.contains(actorSystem)
/** Shuts down all registered [[ActorSystem]]s */
+ // Shut down joining nodes before the first seed node so cluster leave and
remoting
+ // termination can complete while the seed is still available.
// The timeout is dilated by TestKit; keep a larger base for virtualized
JDK 25 nightly runs.
- def shutdownAll(): Unit = actorSystems.foreach(sys => shutdown(sys,
30.seconds, verifySystemShutdown = true))
+ def shutdownAll(): Unit =
+ actorSystems.reverse.foreach(sys => shutdown(sys, 30.seconds,
verifySystemShutdown = true))
/**
* Force the passed [[ActorSystem]] to quit the cluster and shutdown.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]