Minor doc and API cleanup for Test Conductor. See #2049

This commit is contained in:
Björn Antonsson 2012-10-04 11:03:07 +02:00
parent af184250cc
commit 5cfb79aef5
3 changed files with 11 additions and 20 deletions

View file

@ -36,14 +36,16 @@ This is a schematic overview of the test conductor.
.. image:: ../images/akka-remote-testconductor.png .. image:: ../images/akka-remote-testconductor.png
The test conductor server is responsible for coordinating barriers and sending commands to the test conductor The test conductor server is responsible for coordinating barriers and sending commands to the test conductor
clients that act upon them, e.g. throttling network traffic to/from another client. clients that act upon them, e.g. throttling network traffic to/from another client. More information on the
possible operations is availible in the ``akka.remote.testconductor.Conductor`` API documentation.
The Multi Node Spec The Multi Node Spec
=================== ===================
The Multi Node Spec consists of two parts. The ``MultiNodeConfig`` that is responsible for common The Multi Node Spec consists of two parts. The ``MultiNodeConfig`` that is responsible for common
configuration and enumerating and naming the nodes under test. The ``MultiNodeSpec`` that contains all the configuration and enumerating and naming the nodes under test. The ``MultiNodeSpec`` that contains a number
convenience functions for making the test nodes interact with each other. of convenience functions for making the test nodes interact with each other. More information on the possible
operations is available in the ``akka.remote.testkit.MultiNodeSpec`` API documentation.
The setup of the ``MultiNodeSpec`` is configured through java system properties that you set on all JVMs that's going to run a The setup of the ``MultiNodeSpec`` is configured through java system properties that you set on all JVMs that's going to run a
node under test. These can easily be set on the JVM command line with ``-Dproperty=value``. node under test. These can easily be set on the JVM command line with ``-Dproperty=value``.

View file

@ -191,17 +191,6 @@ trait Conductor { this: TestConductorExt ⇒
controller ? Terminate(node, exitValue) mapTo classTag[Done] controller ? Terminate(node, exitValue) mapTo classTag[Done]
} }
/**
* Tell the SBT plugin to forcibly terminate the given remote node using Process.destroy.
*
* @param node is the symbolic name of the node which is to be affected
*/
// TODO: uncomment (and implement in Controller) if really needed
// def kill(node: RoleName): Future[Done] = {
// import Settings.QueryTimeout
// controller ? Terminate(node, -1) mapTo classTag[Done]
// }
/** /**
* Obtain the list of remote host names currently registered. * Obtain the list of remote host names currently registered.
*/ */
@ -455,12 +444,8 @@ private[akka] class Controller(private var initialParticipants: Int, controllerP
val t = nodes(target) val t = nodes(target)
nodes(node).fsm forward ToClient(DisconnectMsg(t.addr, abort)) nodes(node).fsm forward ToClient(DisconnectMsg(t.addr, abort))
case Terminate(node, exitValueOrKill) case Terminate(node, exitValueOrKill)
if (exitValueOrKill < 0) {
// TODO: kill via SBT
} else {
barrier ! BarrierCoordinator.RemoveClient(node) barrier ! BarrierCoordinator.RemoveClient(node)
nodes(node).fsm forward ToClient(TerminateMsg(exitValueOrKill)) nodes(node).fsm forward ToClient(TerminateMsg(exitValueOrKill))
}
case Remove(node) case Remove(node)
barrier ! BarrierCoordinator.RemoveClient(node) barrier ! BarrierCoordinator.RemoveClient(node)
} }

View file

@ -312,6 +312,10 @@ abstract class MultiNodeSpec(val myself: RoleName, _system: ActorSystem, _roles:
} }
} }
/**
* Execute the `yes` block of code only on the given nodes (names according
* to the `roleMap`) else execute the `no` block of code.
*/
def ifNode[T](nodes: RoleName*)(yes: T)(no: T): T = { def ifNode[T](nodes: RoleName*)(yes: T)(no: T): T = {
if (nodes exists (_ == myself)) yes else no if (nodes exists (_ == myself)) yes else no
} }