2.5.10 wire protocol regression (#24625)
This commit is contained in:
parent
58c00b67e5
commit
b7cc50cdd6
7 changed files with 205 additions and 112 deletions
|
|
@ -19,8 +19,9 @@ class ClusterMessageSerializerSpec extends AkkaSpec(
|
|||
val serializer = new ClusterMessageSerializer(system.asInstanceOf[ExtendedActorSystem])
|
||||
|
||||
def roundtrip[T <: AnyRef](obj: T): T = {
|
||||
val manifest = serializer.manifest(obj)
|
||||
val blob = serializer.toBinary(obj)
|
||||
serializer.fromBinary(blob, obj.getClass).asInstanceOf[T]
|
||||
serializer.fromBinary(blob, manifest).asInstanceOf[T]
|
||||
}
|
||||
|
||||
def checkSerialization(obj: AnyRef): Unit = {
|
||||
|
|
@ -82,6 +83,30 @@ class ClusterMessageSerializerSpec extends AkkaSpec(
|
|||
checkSerialization(InternalClusterAction.Welcome(uniqueAddress, g2))
|
||||
}
|
||||
|
||||
"be compatible with wire format of version 2.5.9 (using InitJoin singleton instead of class)" in {
|
||||
// we must use the old singleton class name so that the other side will see an InitJoin
|
||||
// but discard the config as it does not know about the config check
|
||||
val oldClassName = "akka.cluster.InternalClusterAction$InitJoin$"
|
||||
serializer.manifest(InternalClusterAction.InitJoin(ConfigFactory.empty())) should ===(oldClassName)
|
||||
|
||||
// in 2.5.9 and earlier, it was an object and serialized to empty byte array
|
||||
// and we should accept that
|
||||
val deserialized = serializer.fromBinary(Array.emptyByteArray, oldClassName)
|
||||
deserialized shouldBe an[InternalClusterAction.InitJoin]
|
||||
}
|
||||
|
||||
"be compatible with wire format of version 2.5.9 (using serialized address for InitJoinAck)" in {
|
||||
// we must use the old singleton class name so that the other side will see an InitJoin
|
||||
// but discard the config as it does not know about the config check
|
||||
val initJoinAck = InternalClusterAction.InitJoinAck(
|
||||
Address("akka.tcp", "cluster", "127.0.0.1", 2552),
|
||||
InternalClusterAction.UncheckedConfig)
|
||||
val serializedinInitJoinAckPre2510 = serializer.addressToProto(initJoinAck.address).build().toByteArray
|
||||
|
||||
val deserialized = serializer.fromBinary(serializedinInitJoinAckPre2510, ClusterMessageSerializer.InitJoinAckManifest)
|
||||
deserialized shouldEqual initJoinAck
|
||||
}
|
||||
|
||||
"be compatible with wire format of version 2.5.3 (using use-role instead of use-roles)" in {
|
||||
val system = ActorSystem("ClusterMessageSerializer-old-wire-format")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue