Add app-version to the Member information, #27300 (#29546)

* will be used in rolling update features
* configured with akka.cluster.app-version
* reusing same implementation as ManifestInfo.Version
  by moving that to akka.util.Version
* additional version test
* support dynver format, + separator, and commit number
* improve version parser
* lazy parse
* make Member.appVersion internal
This commit is contained in:
Patrik Nordwall 2020-09-10 10:42:03 +02:00 committed by GitHub
parent 73f04f0a23
commit 42223eb71a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 1067 additions and 218 deletions

View file

@ -6,10 +6,13 @@ package akka.cluster
import scala.collection.immutable
import com.typesafe.config.ConfigFactory
import akka.actor.Address
import akka.remote.testkit.MultiNodeConfig
import akka.remote.testkit.MultiNodeSpec
import akka.testkit._
import akka.util.Version
object JoinSeedNodeMultiJvmSpec extends MultiNodeConfig {
val seed1 = role("seed1")
@ -18,7 +21,12 @@ object JoinSeedNodeMultiJvmSpec extends MultiNodeConfig {
val ordinary1 = role("ordinary1")
val ordinary2 = role("ordinary2")
commonConfig(debugConfig(on = false).withFallback(MultiNodeClusterSpec.clusterConfig))
commonConfig(
debugConfig(on = false)
.withFallback(ConfigFactory.parseString("""akka.cluster.app-version="1.0""""))
.withFallback(MultiNodeClusterSpec.clusterConfig))
nodeConfig(ordinary1, ordinary2)(ConfigFactory.parseString("""akka.cluster.app-version="2.0""""))
}
class JoinSeedNodeMultiJvmNode1 extends JoinSeedNodeSpec
@ -57,6 +65,15 @@ abstract class JoinSeedNodeSpec extends MultiNodeSpec(JoinSeedNodeMultiJvmSpec)
cluster.joinSeedNodes(seedNodes)
}
awaitMembersUp(roles.size)
seedNodes.foreach { a =>
cluster.state.members.find(_.address == a).get.appVersion should ===(Version("1.0"))
}
List(address(ordinary1), address(ordinary2)).foreach { a =>
cluster.state.members.find(_.address == a).get.appVersion should ===(Version("2.0"))
}
cluster.state.hasMoreThanOneAppVersion should ===(true)
enterBarrier("after-2")
}
}