Skip to content

Commit 1303acd

Browse files
committed
extra tests
1 parent 542840d commit 1303acd

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

cluster/src/test/scala/org/apache/pekko/cluster/MixedProtocolClusterSpec.scala

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ object MixedProtocolClusterSpec {
2828
pekko.actor.provider = "cluster"
2929
pekko.coordinated-shutdown.terminate-actor-system = on
3030
31-
pekko.remote.classic.netty.tcp.port = 0
3231
pekko.remote.artery.canonical.port = 0
3332
pekko.remote.artery.advanced.aeron.idle-cpu-level = 3
3433
pekko.remote.accept-protocol-names = ["pekko", "akka"]
@@ -42,10 +41,22 @@ object MixedProtocolClusterSpec {
4241
pekko.remote.protocol-name = "pekko"
4342
""").withFallback(baseConfig)
4443

44+
val configWithPekkoTcp: Config =
45+
ConfigFactory.parseString("""
46+
pekko.remote.classic.netty.tcp.port = 0
47+
pekko.remote.protocol-name = "pekko"
48+
""").withFallback(baseConfig)
49+
4550
val configWithAkka: Config =
4651
ConfigFactory.parseString("""
4752
pekko.remote.protocol-name = "akka"
4853
""").withFallback(baseConfig)
54+
55+
val configWithAkkaTcp: Config =
56+
ConfigFactory.parseString("""
57+
pekko.remote.classic.netty.tcp.port = 0
58+
pekko.remote.protocol-name = "akka"
59+
""").withFallback(baseConfig)
4960
}
5061

5162
class MixedProtocolClusterSpec extends PekkoSpec with ClusterTestKit {
@@ -71,6 +82,23 @@ class MixedProtocolClusterSpec extends PekkoSpec with ClusterTestKit {
7182
}
7283
}
7384

85+
"be allowed to join a cluster with a node using the pekko protocol (tcp)" taggedAs LongRunningTest in {
86+
87+
val clusterTestUtil = new ClusterTestUtil(system.name)
88+
// start the first node with the "pekko" protocol
89+
clusterTestUtil.newActorSystem(configWithPekkoTcp)
90+
91+
// have a node using the "akka" protocol join
92+
val joiningNode = clusterTestUtil.newActorSystem(configWithAkkaTcp)
93+
clusterTestUtil.formCluster()
94+
95+
try {
96+
awaitCond(clusterTestUtil.isMemberUp(joiningNode), message = "awaiting joining node to be 'Up'")
97+
} finally {
98+
clusterTestUtil.shutdownAll()
99+
}
100+
}
101+
74102
"allow a node using the pekko protocol to join the cluster" taggedAs LongRunningTest in {
75103

76104
val clusterTestUtil = new ClusterTestUtil(system.name)
@@ -88,5 +116,23 @@ class MixedProtocolClusterSpec extends PekkoSpec with ClusterTestKit {
88116
clusterTestUtil.shutdownAll()
89117
}
90118
}
119+
120+
"allow a node using the pekko protocol to join the cluster (tcp)" taggedAs LongRunningTest in {
121+
122+
val clusterTestUtil = new ClusterTestUtil(system.name)
123+
124+
// create the first node with the "akka" protocol
125+
clusterTestUtil.newActorSystem(configWithAkkaTcp)
126+
127+
// have a node using the "pekko" protocol join
128+
val joiningNode = clusterTestUtil.newActorSystem(configWithPekkoTcp)
129+
clusterTestUtil.formCluster()
130+
131+
try {
132+
awaitCond(clusterTestUtil.isMemberUp(joiningNode), message = "awaiting joining node to be 'Up'")
133+
} finally {
134+
clusterTestUtil.shutdownAll()
135+
}
136+
}
91137
}
92138
}

0 commit comments

Comments
 (0)