akka.remote.testkit.MultiNodeConfig Scala Examples
The following examples show how to use akka.remote.testkit.MultiNodeConfig.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
Example 1
Source File: WordsClusterSpecConfig.scala From 006877 with MIT License | 5 votes |
package aia.cluster package words import akka.remote.testkit.MultiNodeConfig import com.typesafe.config.ConfigFactory object WordsClusterSpecConfig extends MultiNodeConfig { val seed = role("seed") val master = role("master") val worker1 = role("worker-1") val worker2 = role("worker-2") commonConfig(ConfigFactory.parseString(""" akka.actor.provider="akka.cluster.ClusterActorRefProvider" # don't use sigar for tests, native lib not in path akka.cluster.metrics.collector-class = akka.cluster.JmxMetricsCollector """)) }
Example 2
Source File: LithiumMultiNodeSpec.scala From lithium with Apache License 2.0 | 5 votes |
package com.swissborg.lithium import akka.actor.{ActorSystem, Address} import akka.cluster.Cluster import akka.cluster.MemberStatus._ import akka.remote.testconductor.RoleName import akka.remote.testkit.{MultiNodeConfig, MultiNodeSpec, MultiNodeSpecCallbacks} import akka.testkit.ImplicitSender import org.scalatest.BeforeAndAfterAll import org.scalatest.concurrent.{Eventually, IntegrationPatience} import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpecLike abstract class LithiumMultiNodeSpec(val config: MultiNodeConfig) extends MultiNodeSpec(config) with MultiNodeSpecCallbacks with AnyWordSpecLike with Matchers with BeforeAndAfterAll with ImplicitSender with Eventually with IntegrationPatience { override def beforeAll(): Unit = multiNodeSpecBeforeAll() override def afterAll(): Unit = multiNodeSpecAfterAll() private val addresses: Map[RoleName, Address] = roles.map(r => r -> node(r).address).toMap protected def addressOf(roleName: RoleName): Address = addresses(roleName) protected def waitToBecomeUnreachable(roleNames: RoleName*): Unit = awaitCond(allUnreachable(roleNames: _*)) protected def waitForSurvivors(roleNames: RoleName*): Unit = awaitCond(allSurvivors(roleNames: _*)) protected def waitForUp(roleNames: RoleName*): Unit = awaitCond(allUp(roleNames: _*)) protected def waitForSelfDowning(implicit system: ActorSystem): Unit = awaitCond(downedItself) protected def waitForAllLeaving(roleNames: RoleName*): Unit = awaitCond(allLeaving(roleNames: _*)) protected def waitExistsAllDownOrGone(groups: Seq[Seq[RoleName]]): Unit = awaitCond(existsAllDownOrGone(groups)) private def allUnreachable(roleNames: RoleName*): Boolean = roleNames.forall( role => Cluster(system).state.unreachable.exists(_.address === addressOf(role)) ) private def allSurvivors(roleNames: RoleName*): Boolean = roleNames.forall(role => Cluster(system).state.members.exists(_.address === addressOf(role))) private def allUp(roleNames: RoleName*): Boolean = roleNames.forall( role => Cluster(system).state.members.exists(m => m.address === addressOf(role) && m.status === Up) ) private def existsAllDownOrGone(groups: Seq[Seq[RoleName]]): Boolean = groups.exists(group => allLeaving(group: _*)) private def downedItself(implicit system: ActorSystem): Boolean = { val selfAddress = Cluster(system).selfAddress Cluster(system).state.members .exists( m => m.address === selfAddress && (m.status === Exiting || m.status === Down || m.status === Removed) ) } private def allLeaving(roleNames: RoleName*): Boolean = roleNames.forall { role => val members = Cluster(system).state.members val unreachable = Cluster(system).state.unreachable val address = addressOf(role) unreachable.isEmpty && // no unreachable members (members.exists(m => m.address === address && (m.status === Down || m.status === Exiting)) || // member is down !members.exists(_.address === address)) // member is not in the cluster } }
Example 3
Source File: TenNodeSpecConfig.scala From lithium with Apache License 2.0 | 5 votes |
package com.swissborg.lithium import akka.remote.testconductor.RoleName import akka.remote.testkit.MultiNodeConfig import com.typesafe.config.ConfigFactory abstract class TenNodeSpecConfig(resource: String) extends MultiNodeConfig { val node1: RoleName = role("node1") val node2: RoleName = role("node2") val node3: RoleName = role("node3") val node4: RoleName = role("node4") val node5: RoleName = role("node5") val node6: RoleName = role("node6") val node7: RoleName = role("node7") val node8: RoleName = role("node8") val node9: RoleName = role("node9") val node10: RoleName = role("node10") commonConfig(ConfigFactory.parseResources(resource)) testTransport(on = true) }
Example 4
Source File: MultiNodeSampleTest.scala From fusion-data with Apache License 2.0 | 5 votes |
package sample.multinode import akka.actor.{Actor, Props} import akka.remote.testkit.{MultiNodeConfig, MultiNodeSpec} import akka.testkit.ImplicitSender object MultiNodeSampleConfig extends MultiNodeConfig { val node1 = role("node1") val node2 = role("node2") } class MultiNodeSampleTestMultiJvmNode1 extends MultiNodeSampleTest class MultiNodeSampleTestMultiJvmNode2 extends MultiNodeSampleTest object MultiNodeSampleTest { class Ponger extends Actor { def receive = { case "ping" => sender() ! "pong" } } } class MultiNodeSampleTest extends MultiNodeSpec(MultiNodeSampleConfig) with STMultiNodeSpec with ImplicitSender { import MultiNodeSampleConfig._ import MultiNodeSampleTest._ override def initialParticipants: Int = roles.size "A MultiNodeSample" must { "wait for all nodes to enter a barrier" in { enterBarrier("startup") // 当所有节点都发起栅栏消息:startup 后再继续之后代码的运行 } "send to and receive from a remote node" in { runOn(node1) { enterBarrier("deployed") // 等待另一个节点也发起栅栏 deployed val ponger = system.actorSelection(node(node2) / "user" / "ponger") ponger ! "ping" import scala.concurrent.duration._ expectMsg(10.seconds, "pong") println(System.getProperty("akka.remote.port") + " received pong") } runOn(node2) { system.actorOf(Props[Ponger], "ponger") enterBarrier("deployed") println(System.getProperty("akka.remote.port") + " started ponger") } enterBarrier("finished") } } }
Example 5
Source File: MultiNodeSampleSpec.scala From fusion-data with Apache License 2.0 | 5 votes |
package sample import akka.actor.{Actor, Props} import akka.remote.testconductor.RoleName import akka.remote.testkit.{MultiNodeConfig, MultiNodeSpec} import akka.testkit.ImplicitSender import mass.STMultiNodeSpec object MultiNodeSampleConfig extends MultiNodeConfig { val node1: RoleName = role("node1") val node2: RoleName = role("node2") } object MultiNodeSampleSpec { class Ponger extends Actor { def receive: Receive = { case "ping" => sender() ! "pong" } } } class MultiNodeSampleSpec extends MultiNodeSpec(MultiNodeSampleConfig) with STMultiNodeSpec with ImplicitSender { import MultiNodeSampleSpec._ import MultiNodeSampleConfig._ // 设置参与者数量,之后的Barrier(enterBarrier)需要满足此数量后才运行之后的代码。 def initialParticipants: Int = roles.size "A MultiNodeSampleSpec" must { "wait for all nodes to enter a barrier" in { enterBarrier("startup") } "send to and receive from a remote node" in { runOn(node1) { // 进入 deployed barrier,等待另一个节点实例化 actor 完成。 enterBarrier("deployed") val ponger = system.actorSelection(node(node2) / "user" / "ponger") ponger ! "ping" import scala.concurrent.duration._ expectMsg(10.seconds, "pong") // 阻塞接收并assert消息,10秒超时 } runOn(node2) { system.actorOf(Props[Ponger], "ponger") // 先实例化actor,再进入 deployed barrier enterBarrier("deployed") } enterBarrier("finished") } } } class MultiNodeSampleSpecMultiJvmNode1 extends MultiNodeSampleSpec class MultiNodeSampleSpecMultiJvmNode2 extends MultiNodeSampleSpec
Example 6
Source File: MultiNodeBaseSpec.scala From NSDb with Apache License 2.0 | 5 votes |
package io.radicalbit.nsdb.split_brain import akka.actor.Address import akka.cluster.MemberStatus.{Down, Exiting, Removed, Up} import akka.remote.testconductor.RoleName import akka.remote.testkit.{MultiNodeConfig, MultiNodeSpec} import akka.remote.transport.ThrottlerTransportAdapter.Direction import akka.testkit.ImplicitSender import io.radicalbit.rtsae.STMultiNodeSpec import scala.concurrent.duration.Duration abstract class MultiNodeBaseSpec(config: MultiNodeConfig) extends MultiNodeSpec(config) with STMultiNodeSpec with ImplicitSender { def initialParticipants: Int = roles.size private val addresses: Map[RoleName, Address] = roles.map(r => r -> node(r).address).toMap protected def addressOf(roleName: RoleName): Address = addresses(roleName) protected def awaitClusterNodesForUp(roleNames: RoleName*): Unit = awaitCond { roleNames.forall( role => cluster.state.members.exists(m => m.address === addressOf(role) && m.status === Up) ) } protected def awaitClusterLeader(nodesInCluster: RoleName*): Unit = if (nodesInCluster.contains(myself)) { nodesInCluster.length should not be 0 awaitCond(nodesInCluster.map(addressOf).contains(cluster.state.getLeader)) } protected def awaitUnreachableNodes(unreachableNodes: RoleName*): Unit = awaitCond(cluster.state.unreachable.map(_.address) === unreachableNodes.map(addressOf).toSet) protected def switchOffConnection(from: RoleName, to: RoleName) = testConductor.blackhole(from, to, Direction.Both).await protected def awaitSurvivorsNodes(roleNames: RoleName*): Unit = awaitCond(roleNames.forall(role => cluster.state.members.exists(_.address === addressOf(role)))) protected def awaitAllLeavingNodes(roleNames: RoleName*): Unit = awaitCond(roleNames.forall { role => val members = cluster.state.members val unreachable = cluster.state.unreachable val address = addressOf(role) unreachable.isEmpty && (members.exists(m => m.address === address && (m.status === Down || m.status === Exiting)) || !members.exists(_.address === address)) }) protected def awaitSelfDowningNode(max: Duration = Duration.Undefined) = awaitCond( { val selfAddress = cluster.selfAddress cluster.state.members.exists(m => m.address === selfAddress && (m.status === Exiting || m.status === Down || m.status === Removed)) }, max ) protected def awaitExistingMembers(roleNames: RoleName*): Unit = awaitCond(cluster.state.members.map(_.address) === roleNames.map(addressOf).toSet) }
Example 7
Source File: SimpleDowningConfig.scala From simple-akka-downing with Apache License 2.0 | 5 votes |
package com.ajjpj.simpleakkadowning.util import java.util.UUID import akka.remote.testkit.MultiNodeConfig import com.typesafe.config.ConfigFactory abstract class SimpleDowningConfig(strategy: String, strategyConfig: (String,String)*) extends MultiNodeConfig { commonConfig(ConfigFactory.parseResources("application.conf")) final val CLUSTER_SIZE = 5 final val ROLE_SIZE = 3 private var numRoles = 0 // 'roles' in the sense of multi-jvm testing, not in the sense of Akka cluster roles override def role (name: String) = { val roleName = super.role (name) if (numRoles > 0) { var clusterRoles = Vector.empty[String] if (numRoles <= ROLE_SIZE) clusterRoles :+= "with-oldest" if (numRoles > CLUSTER_SIZE - ROLE_SIZE) clusterRoles :+= "without-oldest" val configString = s"""akka.actor.provider=cluster |akka.actor.warn-about-java-serializer-usage = off |akka.cluster { | jmx.enabled = off | gossip-interval = 100 ms | leader-actions-interval = 100 ms | unreachable-nodes-reaper-interval = 100 ms | periodic-tasks-initial-delay = 100 ms | publish-stats-interval = 0 s # always, when it happens | failure-detector.heartbeat-interval = 100 ms | | roles = ${clusterRoles.mkString("[", ",", "]")} | | run-coordinated-shutdown-when-down = off |} |akka.loglevel = INFO |akka.log-dead-letters = off |akka.log-dead-letters-during-shutdown = off |akka.remote { | log-remote-lifecycle-events = off | artery.advanced.flight-recorder { | enabled=on | destination=target/flight-recorder-${UUID.randomUUID ().toString}.afr | } |} |akka.loggers = ["akka.testkit.TestEventListener"] |akka.test { | single-expect-default = 5 s |} | |akka.remote.retry-gate-closed-for = 3 s |akka.cluster { | failure-detector.threshold = 3 |} | | |akka.cluster.downing-provider-class = com.ajjpj.simpleakkadowning.SimpleAkkaDowningProvider | |simple-akka-downing.stable-after=5s |simple-akka-downing.active-strategy=$strategy |""".stripMargin + strategyConfig.map(c => s"simple-akka-downing.$strategy.${c._1}=${c._2}").mkString("\n") nodeConfig (roleName)(ConfigFactory.parseString (configString)) } numRoles += 1 roleName } val conductor = role("0") val node1 = role("1") val node2 = role("2") val node3 = role("3") val node4 = role("4") val node5 = role("5") // commonConfig(debugConfig(true)) testTransport(true) }
Example 8
Source File: ClusterConfig.scala From akka-cqrs with Apache License 2.0 | 5 votes |
package test.support import akka.remote.testkit.MultiNodeConfig import com.typesafe.config.ConfigFactory object ClusterConfig extends MultiNodeConfig { val node1 = role("node1") val node2 = role("node2") commonConfig( ConfigFactory.parseString( """ akka { loglevel = ERROR loggers = ["akka.event.slf4j.Slf4jLogger"] actor { provider = "akka.cluster.ClusterActorRefProvider" serialize-messages = on } remote { log-remote-lifecycle-events = off netty.tcp { hostname = "127.0.0.1" port = 0 } } cluster { seed-nodes = [ "akka.tcp://[email protected]:2551", "akka.tcp://[email protected]:2552"] auto-down-unreachable-after = 20s } persistence { journal.plugin = "akka.persistence.journal.leveldb-shared" journal.leveldb-shared.store { native = off dir = "target/test-shared-journal" } } } """ ).withFallback(ConfigFactory.load())) }
Example 9
Source File: ClusteredTeskit.scala From lagom with Apache License 2.0 | 5 votes |
package com.lightbend.lagom.internal.cluster import akka.actor.ActorRef import akka.actor.ActorSystem import akka.actor.Address import akka.actor.BootstrapSetup import akka.actor.setup.ActorSystemSetup import akka.cluster.Cluster import akka.cluster.MemberStatus import akka.remote.testconductor.RoleName import com.typesafe.config.ConfigFactory import akka.remote.testkit.MultiNodeConfig import akka.remote.testkit.MultiNodeSpec import akka.testkit.ImplicitSender import com.lightbend.lagom.internal.cluster.ClusterMultiNodeConfig.node1 import com.typesafe.config.Config import scala.concurrent.duration._ object ClusterMultiNodeConfig extends ClusterMultiNodeConfig // this is reused in multiple multi-jvm tests. There's still some copy/paste around though. abstract class ClusterMultiNodeConfig extends MultiNodeConfig { val node1 = role("node1") val node2 = role("node2") val node3 = role("node3") protected def systemConfig: Config = ConfigFactory.parseString( """ akka.loglevel = INFO akka.actor.provider = cluster terminate-system-after-member-removed = 60s # increase default timeouts to leave wider margin for Travis. # 30s to 60s akka.testconductor.barrier-timeout=60s akka.test.single-expect-default = 15s akka.cluster.sharding.waiting-for-state-timeout = 5s # Don't terminate the actor system when doing a coordinated shutdown akka.coordinated-shutdown.terminate-actor-system = off akka.coordinated-shutdown.run-by-jvm-shutdown-hook = off akka.cluster.run-coordinated-shutdown-when-down = off ## The settings below are incidental because this code lives in a project that depends on lagom-cluster and ## lagom-akka-management-core. # multi-jvm tests forms the cluster programmatically # therefore we disable Akka Cluster Bootstrap lagom.cluster.bootstrap.enabled = off # no jvm exit on tests lagom.cluster.exit-jvm-when-system-terminated = off """ ) commonConfig(systemConfig) } // heavily inspired by AbstractClusteredPersistentEntitySpec // this is reused in multiple multi-jvm tests. There's still some copy/paste around though. object ClusterMultiNodeActorSystemFactory { // Copied from MultiNodeSpec private def getCallerName(clazz: Class[_]): String = { val s = Thread.currentThread.getStackTrace.map(_.getClassName).drop(1).dropWhile(_.matches(".*MultiNodeSpec.?$")) val reduced = s.lastIndexWhere(_ == clazz.getName) match { case -1 => s case z => s.drop(z + 1) } reduced.head.replaceFirst(""".*\.""", "").replaceAll("[^a-zA-Z_0-9]", "_") } def createActorSystem(): Config => ActorSystem = { config => val setup = ActorSystemSetup(BootstrapSetup(ConfigFactory.load(config))) ActorSystem(getCallerName(classOf[MultiNodeSpec]), setup) } }
Example 10
Source File: MultiNodeReplicationConfig.scala From eventuate with Apache License 2.0 | 5 votes |
package com.rbmhtechnology.eventuate import akka.remote.testkit.MultiNodeConfig import com.typesafe.config._ trait MultiNodeReplicationConfig extends MultiNodeConfig { def setConfig(customConfig: Config): Unit = { val defaultConfig = ConfigFactory.parseString( s""" |akka.test.single-expect-default = 20s |akka.testconductor.barrier-timeout = 60s |akka.loglevel = "ERROR" | |eventuate.log.write-batch-size = 3 |eventuate.log.replication.retry-delay = 1s |eventuate.log.replication.failure-detection-limit = 60s | |eventuate.snapshot.filesystem.dir = target/test-snapshot """.stripMargin) commonConfig(customConfig.withFallback(defaultConfig)) } }
Example 11
Source File: ProxyMultiJvm.scala From 006877 with MIT License | 5 votes |
package aia.channels // multi-jvm:test-only aia.channels.ReliableProxySampleSpec 로 시작할것 import org.scalatest.{WordSpecLike, BeforeAndAfterAll, MustMatchers} import akka.testkit.ImplicitSender import akka.actor.{Props, Actor} import akka.remote.testkit.MultiNodeSpecCallbacks import akka.remote.testkit.MultiNodeConfig import akka.remote.testkit.MultiNodeSpec trait STMultiNodeSpec extends MultiNodeSpecCallbacks with WordSpecLike with MustMatchers with BeforeAndAfterAll { override def beforeAll() = multiNodeSpecBeforeAll() override def afterAll() = multiNodeSpecAfterAll() } object ReliableProxySampleConfig extends MultiNodeConfig { val client = role("Client") val server = role("Server") testTransport(on = true) } class ReliableProxySampleSpecMultiJvmNode1 extends ReliableProxySample class ReliableProxySampleSpecMultiJvmNode2 extends ReliableProxySample import akka.remote.transport.ThrottlerTransportAdapter.Direction import scala.concurrent.duration._ import concurrent.Await import akka.contrib.pattern.ReliableProxy class ReliableProxySample extends MultiNodeSpec(ReliableProxySampleConfig) with STMultiNodeSpec with ImplicitSender { import ReliableProxySampleConfig._ def initialParticipants = roles.size "A MultiNodeSample" must { "wait for all nodes to enter a barrier" in { enterBarrier("startup") } "send to and receive from a remote node" in { runOn(client) { enterBarrier("deployed") val pathToEcho = node(server) / "user" / "echo" val echo = system.actorSelection(pathToEcho) val proxy = system.actorOf( ReliableProxy.props(pathToEcho, 500.millis), "proxy") proxy ! "message1" expectMsg("message1") Await.ready( testConductor.blackhole( client, server, Direction.Both), 1 second) echo ! "DirectMessage" proxy ! "ProxyMessage" expectNoMsg(3 seconds) Await.ready( testConductor.passThrough( client, server, Direction.Both), 1 second) expectMsg("ProxyMessage") echo ! "DirectMessage2" expectMsg("DirectMessage2") } runOn(server) { system.actorOf(Props(new Actor { def receive = { case msg: AnyRef => { sender() ! msg } } }), "echo") enterBarrier("deployed") } enterBarrier("finished") } } }
Example 12
Source File: MultiDcSpec.scala From JustinDB with Apache License 2.0 | 5 votes |
package justin.db import akka.remote.testkit.{MultiNodeConfig, MultiNodeSpec} import com.typesafe.config.ConfigFactory final class MultiDcSpecConfig(crossDcConnections: Int = 1) extends MultiNodeConfig { val first = role("first") val second = role("second") private[this] val allRoles = List(first, second) private[this] val clusterName = "MultiDcSpec" private[this] def commonNodeConfig(id: Int) = ConfigFactory.parseString( s""" |justin.system = $clusterName |justin.kubernetes-hostname = s"justindb-$id" |justin.http.port = ${9000 + id} |akka.cluster.role.storagenode.min-nr-of-members = ${allRoles.size} |akka.cluster.http.management.port = ${19999 + id} |akka.cluster.seed-nodes.0 = "akka.tcp://$clusterName@localhost:25551" |akka.remote.netty.tcp.port = ${25551 + id} |akka.remote.netty.tcp.hostname = "localhost" |akka.cluster.multi-data-center.cross-data-center-connections = $crossDcConnections |akka.cluster.multi-data-center.self-data-center = "dc$id" """.stripMargin ) commonConfig(MultiNodeClusterSpec.commonBaseConfig.withFallback(JustinDBConfig.init.config)) allRoles.zipWithIndex.foreach { case (roleName, id) => nodeConfig(roleName)(commonNodeConfig(id)) } } final class MultiDcMultiJvm1 extends MultiDcSpec final class MultiDcMultiJvm2 extends MultiDcSpec abstract class MultiDcSpec(config: MultiDcSpecConfig) extends MultiNodeSpec(config) with MultiNodeClusterSpec { def this() = this(new MultiDcSpecConfig()) "A cluster with multiple data centers" must { "be able to form" in { val config = new JustinDBConfig(system.settings.config) val justinDB = JustinDB.init(config)(system) enterBarrier("justindb-cluster-up") } } }
Example 13
Source File: ConvergeJustinDBClusterSpec.scala From JustinDB with Apache License 2.0 | 5 votes |
package justin.db import akka.remote.testkit.{MultiNodeConfig, MultiNodeSpec} import com.typesafe.config.ConfigFactory final class ConvergeJustinDBClusterConfig extends MultiNodeConfig { val first = role("first") val second = role("second") val third = role("third") private[this] val allRoles = List(first, second, third) private[this] val clusterName = "ConvergeJustinDBClusterSpec" private[this] def commonNodeConfig(id: Int) = ConfigFactory.parseString( s""" |justin.system = $clusterName |justin.kubernetes-hostname = s"justindb-$id" |justin.http.port = ${9000 + id} |akka.cluster.role.storagenode.min-nr-of-members = ${allRoles.size} |akka.cluster.http.management.port = ${19999 + id} |akka.cluster.seed-nodes.0 = "akka.tcp://$clusterName@localhost:25551" |akka.remote.netty.tcp.port = ${25551 + id} |akka.remote.netty.tcp.hostname = "localhost" """.stripMargin ) commonConfig(MultiNodeClusterSpec.commonBaseConfig.withFallback(JustinDBConfig.init.config)) allRoles.zipWithIndex.foreach { case (roleName, id) => nodeConfig(roleName)(commonNodeConfig(id)) } } final class ConvergeJustinDBClusterSpecMultiJvmNode1 extends ConvergeJustinDBClusterSpec final class ConvergeJustinDBClusterSpecMultiJvmNode2 extends ConvergeJustinDBClusterSpec final class ConvergeJustinDBClusterSpecMultiJvmNode3 extends ConvergeJustinDBClusterSpec abstract class ConvergeJustinDBClusterSpec(config: ConvergeJustinDBClusterConfig) extends MultiNodeSpec(config) with MultiNodeClusterSpec { def this() = this(new ConvergeJustinDBClusterConfig()) "A cluster" must { "be able to form" in { val config = new JustinDBConfig(system.settings.config) val justinDB = JustinDB.init(config)(system) enterBarrier("justindb-cluster-up") } } }
Example 14
Source File: MultiNodeQuorumLeaderAutoDownSpecConfig.scala From akka-cluster-custom-downing with Apache License 2.0 | 5 votes |
package tanukki.akka.cluster.autodown import akka.cluster.MultiNodeClusterSpec import akka.remote.testkit.MultiNodeConfig import com.typesafe.config.ConfigFactory final case class MultiNodeQuorumLeaderAutoDownSpecConfig(failureDetectorPuppet: Boolean) extends MultiNodeConfig { val nodeA = role("nodeA") val nodeB = role("nodeB") val nodeC = role("nodeC") val nodeD = role("nodeD") val nodeE = role("nodeE") commonConfig(ConfigFactory.parseString( """ |akka.cluster.downing-provider-class = "tanukki.akka.cluster.autodown.QuorumLeaderAutoDowning" |custom-downing { | stable-after = 1s | | quorum-leader-auto-downing { | role = "role" | quorum-size = 3 | down-if-out-of-quorum = true | shutdown-actor-system-on-resolution = false | } |} |akka.cluster.metrics.enabled=off |akka.actor.warn-about-java-serializer-usage = off |akka.remote.log-remote-lifecycle-events = off """.stripMargin) .withFallback(MultiNodeClusterSpec.clusterConfig(failureDetectorPuppet)) ) nodeConfig(nodeA, nodeB, nodeC, nodeD, nodeE)(ConfigFactory.parseString( """ |akka.cluster { | roles = [role] |} """.stripMargin)) }
Example 15
Source File: MultiNodeRoleLeaderDownRolesSpecConfig.scala From akka-cluster-custom-downing with Apache License 2.0 | 5 votes |
package tanukki.akka.cluster.autodown import akka.cluster.MultiNodeClusterSpec import akka.remote.testkit.MultiNodeConfig import com.typesafe.config.ConfigFactory final case class MultiNodeRoleLeaderDownRolesSpecConfig(failureDetectorPuppet: Boolean) extends MultiNodeConfig { val node_A_1 = role("node-A-1") val node_A_2 = role("node-A-2") val node_A_3 = role("node-A-3") val node_B_1 = role("node-B-1") val node_B_2 = role("node-B-2") commonConfig(ConfigFactory.parseString( """ |akka.cluster.downing-provider-class = "tanukki.akka.cluster.autodown.RoleLeaderAutoDowningRoles" |custom-downing { | stable-after = 0s | role-leader-auto-downing-roles { | leader-role = "role-A" | target-roles = [role-B] | } |} |akka.cluster.metrics.enabled=off |akka.actor.warn-about-java-serializer-usage = off |akka.remote.log-remote-lifecycle-events = off """.stripMargin) .withFallback(MultiNodeClusterSpec.clusterConfig(failureDetectorPuppet)) ) nodeConfig(node_A_1, node_A_2, node_A_3)(ConfigFactory.parseString( """ |akka.cluster { | roles = [role-A] |} """.stripMargin)) nodeConfig(node_B_1, node_B_2)(ConfigFactory.parseString( """ |akka.cluster { | roles = [role-B] |} """.stripMargin)) }
Example 16
Source File: MultiNodeOldestAutoDownSpecConfig.scala From akka-cluster-custom-downing with Apache License 2.0 | 5 votes |
package tanukki.akka.cluster.autodown import akka.cluster.MultiNodeClusterSpec import akka.remote.testkit.MultiNodeConfig import com.typesafe.config.ConfigFactory final case class MultiNodeOldestAutoDownSpecConfig(failureDetectorPuppet: Boolean) extends MultiNodeConfig { val nodeA = role("nodeA") val nodeB = role("nodeB") val nodeC = role("nodeC") val nodeD = role("nodeD") val nodeE = role("nodeE") commonConfig(ConfigFactory.parseString( """ |akka.cluster.downing-provider-class = "tanukki.akka.cluster.autodown.OldestAutoDowning" |custom-downing { | stable-after = 1s | | oldest-auto-downing { | oldest-member-role = "" | down-if-alone = true | shutdown-actor-system-on-resolution = false | } |} |akka.cluster.metrics.enabled=off |akka.actor.warn-about-java-serializer-usage = off |akka.remote.log-remote-lifecycle-events = off """.stripMargin) .withFallback(MultiNodeClusterSpec.clusterConfig(failureDetectorPuppet)) ) nodeConfig(nodeA, nodeB, nodeC, nodeD, nodeE)(ConfigFactory.parseString( """ |akka.cluster { | roles = [role] |} """.stripMargin)) }
Example 17
Source File: MultiNodeMajorityLeaderAutoDownSpecConfig.scala From akka-cluster-custom-downing with Apache License 2.0 | 5 votes |
package tanukki.akka.cluster.autodown import akka.cluster.MultiNodeClusterSpec import akka.remote.testkit.MultiNodeConfig import com.typesafe.config.ConfigFactory final case class MultiNodeMajorityLeaderAutoDownSpecConfig(failureDetectorPuppet: Boolean) extends MultiNodeConfig { val nodeA = role("nodeA") val nodeB = role("nodeB") val nodeC = role("nodeC") val nodeD = role("nodeD") val nodeE = role("nodeE") commonConfig(ConfigFactory.parseString( """ |akka.cluster.downing-provider-class = "tanukki.akka.cluster.autodown.MajorityLeaderAutoDowning" |custom-downing { | stable-after = 2s | | majority-leader-auto-downing { | role = "role" | down-if-in-minority = true | shutdown-actor-system-on-resolution = false | } |} |akka.cluster.metrics.enabled=off |akka.actor.warn-about-java-serializer-usage = off |akka.remote.log-remote-lifecycle-events = off """.stripMargin) .withFallback(MultiNodeClusterSpec.clusterConfig(failureDetectorPuppet)) ) nodeConfig(nodeA, nodeB, nodeC, nodeD, nodeE)(ConfigFactory.parseString( """ |akka.cluster { | roles = [role] |} """.stripMargin)) }
Example 18
Source File: MultiNodeLeaderAutoDownRolesSpecConfig.scala From akka-cluster-custom-downing with Apache License 2.0 | 5 votes |
package tanukki.akka.cluster.autodown import akka.cluster.MultiNodeClusterSpec import akka.remote.testkit.MultiNodeConfig import com.typesafe.config.ConfigFactory final case class MultiNodeLeaderAutoDownRolesSpecConfig(failureDetectorPuppet: Boolean) extends MultiNodeConfig { val node_A_1 = role("node-A-1") val node_A_2 = role("node-A-2") val node_A_3 = role("node-A-3") val node_B_1 = role("node-B-1") commonConfig(ConfigFactory.parseString( """ |akka.cluster.downing-provider-class = "tanukki.akka.cluster.autodown.LeaderAutoDowningRoles" |custom-downing { | stable-after = 0s | | leader-auto-downing-roles { | target-roles = [role-A] | } |} |akka.cluster.metrics.enabled=off |akka.actor.warn-about-java-serializer-usage = off |akka.remote.log-remote-lifecycle-events = off """.stripMargin) .withFallback(MultiNodeClusterSpec.clusterConfig(failureDetectorPuppet)) ) nodeConfig(node_A_1, node_A_2, node_A_3)(ConfigFactory.parseString( """ |akka.cluster { | roles = [role-A] |} """.stripMargin)) nodeConfig(node_B_1)(ConfigFactory.parseString( """ |akka.cluster { | roles = [role-B] |} """.stripMargin)) }