From 1303acdb3b44f694f38e0f9486084ab9852d9b9f Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sat, 28 Dec 2024 17:50:49 +0100 Subject: [PATCH] extra tests --- .../cluster/MixedProtocolClusterSpec.scala | 48 ++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/cluster/src/test/scala/org/apache/pekko/cluster/MixedProtocolClusterSpec.scala b/cluster/src/test/scala/org/apache/pekko/cluster/MixedProtocolClusterSpec.scala index 45382f4b35..b40719a55b 100644 --- a/cluster/src/test/scala/org/apache/pekko/cluster/MixedProtocolClusterSpec.scala +++ b/cluster/src/test/scala/org/apache/pekko/cluster/MixedProtocolClusterSpec.scala @@ -28,7 +28,6 @@ object MixedProtocolClusterSpec { pekko.actor.provider = "cluster" pekko.coordinated-shutdown.terminate-actor-system = on - pekko.remote.classic.netty.tcp.port = 0 pekko.remote.artery.canonical.port = 0 pekko.remote.artery.advanced.aeron.idle-cpu-level = 3 pekko.remote.accept-protocol-names = ["pekko", "akka"] @@ -42,10 +41,22 @@ object MixedProtocolClusterSpec { pekko.remote.protocol-name = "pekko" """).withFallback(baseConfig) + val configWithPekkoTcp: Config = + ConfigFactory.parseString(""" + pekko.remote.classic.netty.tcp.port = 0 + pekko.remote.protocol-name = "pekko" + """).withFallback(baseConfig) + val configWithAkka: Config = ConfigFactory.parseString(""" pekko.remote.protocol-name = "akka" """).withFallback(baseConfig) + + val configWithAkkaTcp: Config = + ConfigFactory.parseString(""" + pekko.remote.classic.netty.tcp.port = 0 + pekko.remote.protocol-name = "akka" + """).withFallback(baseConfig) } class MixedProtocolClusterSpec extends PekkoSpec with ClusterTestKit { @@ -71,6 +82,23 @@ class MixedProtocolClusterSpec extends PekkoSpec with ClusterTestKit { } } + "be allowed to join a cluster with a node using the pekko protocol (tcp)" taggedAs LongRunningTest in { + + val clusterTestUtil = new ClusterTestUtil(system.name) + // start the first node with the "pekko" protocol + clusterTestUtil.newActorSystem(configWithPekkoTcp) + + // have a node using the "akka" protocol join + val joiningNode = clusterTestUtil.newActorSystem(configWithAkkaTcp) + clusterTestUtil.formCluster() + + try { + awaitCond(clusterTestUtil.isMemberUp(joiningNode), message = "awaiting joining node to be 'Up'") + } finally { + clusterTestUtil.shutdownAll() + } + } + "allow a node using the pekko protocol to join the cluster" taggedAs LongRunningTest in { val clusterTestUtil = new ClusterTestUtil(system.name) @@ -88,5 +116,23 @@ class MixedProtocolClusterSpec extends PekkoSpec with ClusterTestKit { clusterTestUtil.shutdownAll() } } + + "allow a node using the pekko protocol to join the cluster (tcp)" taggedAs LongRunningTest in { + + val clusterTestUtil = new ClusterTestUtil(system.name) + + // create the first node with the "akka" protocol + clusterTestUtil.newActorSystem(configWithAkkaTcp) + + // have a node using the "pekko" protocol join + val joiningNode = clusterTestUtil.newActorSystem(configWithPekkoTcp) + clusterTestUtil.formCluster() + + try { + awaitCond(clusterTestUtil.isMemberUp(joiningNode), message = "awaiting joining node to be 'Up'") + } finally { + clusterTestUtil.shutdownAll() + } + } } }