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 46b8a78eb6 Use distinct live ports in the cluster configuration 
regression (#3657)
46b8a78eb6 is described below

commit 46b8a78eb63aaeac54abc6df21b7cbc57f4e1bff
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Fri Oct 23 21:50:12 2026 +0800

    Use distinct live ports in the cluster configuration regression (#3657)
    
    * Use distinct live ports in the cluster configuration regression
    
    Motivation:
    
    The cluster configuration test needs two simultaneously reserved, distinct 
addresses rather than reusing a single ephemeral port.
    
    Modification:
    
    Retain both server sockets while selecting addresses and assert two 
distinct members reach Up.
    
    Result:
    
    The test encodes the intended two-node configuration and port contract.
    
    Tests:
    
    - Passed: `+headerCheckAll`.
    - Passed: `cluster-typed / Test / testOnly 
docs.org.apache.pekko.cluster.typed.BasicClusterConfigSpec`.
    - Full `validatePullRequest` is left to remote CI.
    
    References:
    
    - Refs [akka/akka-core#32151](https://github.com/akka/akka-core/pull/32151).
    - Upstream commit: 
[b28879c7a4f85e0fdfbac0899c8b4c546aa7c4bc](https://github.com/akka/akka-core/commit/b28879c7a4f85e0fdfbac0899c8b4c546aa7c4bc).
    - Source snapshot: Akka `v2.9.0` 
(`bf20e967571574994ccb3cae411401f5a9021ab9`). Its 
[license](https://github.com/akka/akka-core/blob/v2.9.0/LICENSE) names 
2026-10-23 as the Change Date and Apache License 2.0 as the Change License. 
`LICENSE` and `NOTICE` record the source, and original copyright notices are 
retained. Headers were generated/checked with the project sbt tasks.
    
    * Keep licensing metadata outside the migration change
    
    Motivation:
    Keep PR #3657 scoped to its code or documentation change.
    
    Modification:
    Restore the root LICENSE and NOTICE files to main.
    
    Result:
    The migration diff retains its source headers without repository-level 
licensing edits.
    
    Tests:
    - git diff --check passed.
    - Verified every other file is unchanged; prior focused validation still 
applies.
    
    References:
    Refs #3657.
    
    * Consolidate the cluster example copyright notice #3657
    
    Motivation:
    The review requested a single Lightbend notice in the cluster configuration 
example.
    
    Modification:
    Consolidate the duplicate notices into the 2018-2023 notice.
    
    Result:
    One notice retains the original and source year coverage and ownership.
    
    Tests:
    Validation used a local integration checkout with current main and the 
other review fixes.
    
    - cluster-typed / Test / testOnly 
docs.org.apache.pekko.cluster.typed.BasicClusterConfigSpec: passed.
    - headerCreateAll, +headerCheckAll, native scalafmt, and git diff --check: 
passed.
    - Full validation is delegated to remote CI.
    
    References:
    Refs #3657.
---
 .../pekko/cluster/typed/BasicClusterExampleSpec.scala  | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git 
a/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/BasicClusterExampleSpec.scala
 
b/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/BasicClusterExampleSpec.scala
index 1fa6076d9b..4450177cff 100644
--- 
a/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/BasicClusterExampleSpec.scala
+++ 
b/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/BasicClusterExampleSpec.scala
@@ -8,7 +8,7 @@
  */
 
 /*
- * Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
+ * Copyright (C) 2018-2023 Lightbend Inc. <https://www.lightbend.com>
  */
 
 package docs.org.apache.pekko.cluster.typed
@@ -128,8 +128,10 @@ class BasicClusterConfigSpec extends AnyWordSpec with 
ScalaFutures with Eventual
   "Cluster API" must {
     "init cluster" in {
       // config is pulled into docs, but we don't want to hardcode ports 
because that makes for brittle tests
-      val sys1Port = SocketUtil.temporaryLocalPort()
-      val sys2Port = SocketUtil.temporaryLocalPort()
+      val addresses = SocketUtil.temporaryServerAddresses(2, hostname = 
"127.0.0.1")
+      val sys1Port = addresses.head.getPort
+      val sys2Port = addresses.last.getPort
+      sys1Port should not be sys2Port
       def config(port: Int) = ConfigFactory.parseString(s"""
           pekko.remote.classic.netty.tcp.port = $port
           pekko.remote.artery.canonical.port = $port
@@ -142,8 +144,14 @@ class BasicClusterConfigSpec extends AnyWordSpec with 
ScalaFutures with Eventual
       val system2 =
         ActorSystem[Nothing](Behaviors.empty[Nothing], "ClusterSystem", 
config(sys2Port).withFallback(configSystem2))
       try {
-        Cluster(system1)
-        Cluster(system2)
+        val clusters = Seq(Cluster(system1), Cluster(system2))
+        eventually {
+          clusters.foreach { cluster =>
+            cluster.state.members.size shouldBe 2
+            cluster.state.members.unsorted.map(_.status) shouldBe 
Set(MemberStatus.Up)
+            cluster.state.members.unsorted.map(_.address.port.get) shouldBe 
Set(sys1Port, sys2Port)
+          }
+        }
       } finally {
         ActorTestKit.shutdown(system1)
         ActorTestKit.shutdown(system2)


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

Reply via email to