Class TestConductor
The conductor is the one orchestrating the test: it governs the Akka.Remote.TestKit.Controller's ports to which all Players connect, it issues commands to their FailureInjectorTransportAdapter and provides support for barriers using the Akka.Remote.TestKit.BarrierCoordinator. All of this is bundled inside the TestConductor
Implements
Inherited Members
Namespace: Akka.Remote.TestKit
Assembly: Akka.Remote.TestKit.dll
Syntax
public class TestConductor : IExtension
Constructors
| Improve this Doc View SourceTestConductor(ActorSystem)
Declaration
public TestConductor(ActorSystem system)
Parameters
Type | Name | Description |
---|---|---|
ActorSystem | system |
Properties
| Improve this Doc View SourceAddress
Transport address of this Helios-like remote transport.
Declaration
public Address Address { get; }
Property Value
Type | Description |
---|---|
Address |
Client
Declaration
public IActorRef Client { get; }
Property Value
Type | Description |
---|---|
IActorRef |
Controller
Declaration
public IActorRef Controller { get; }
Property Value
Type | Description |
---|---|
IActorRef |
Settings
Declaration
public TestConductorSettings Settings { get; }
Property Value
Type | Description |
---|---|
TestConductorSettings |
Transport
Remote transport used by the actor ref provider.
Declaration
public RemoteTransport Transport { get; }
Property Value
Type | Description |
---|---|
Akka.Remote.RemoteTransport |
Methods
| Improve this Doc View SourceAbort(RoleName, RoleName)
Tell the remote support to TCP_RESET the connection to the given remote peer. It works regardless of whether the recipient was initiator or responder.
Declaration
public Task<Done> Abort(RoleName node, RoleName target)
Parameters
Type | Name | Description |
---|---|---|
RoleName | node | is the symbolic name of the node which is to be affected |
RoleName | target | is the symbolic name of the other node to which connectivity shall be impeded |
Returns
Type | Description |
---|---|
Task<Done> |
Blackhole(RoleName, RoleName, ThrottleTransportAdapter.Direction)
Switch the helios pipeline of the remote support into blackhole mode for sending and/or receiving: it will just drop all messages right before submitting them to the Socket or right after receiving them from the Socket.
====Note====
To use this feature you must activate the failure injector and throttler
transport adapters by specifying testTransport(on = true)
in your MultiNodeConfig.
Declaration
public Task<Done> Blackhole(RoleName node, RoleName target, ThrottleTransportAdapter.Direction direction)
Parameters
Type | Name | Description |
---|---|---|
RoleName | node | is the symbolic name of the node which is to be affected |
RoleName | target | is the symbolic name of the other node to which connectivity shall be impeded |
ThrottleTransportAdapter.Direction | direction | can be either |
Returns
Type | Description |
---|---|
Task<Done> |
Disconnect(RoleName, RoleName)
Tell the remote support to TCP_RESET the connection to the given remote peer. It works regardless of whether the recipient was initiator or responder.
Declaration
public Task<Done> Disconnect(RoleName node, RoleName target)
Parameters
Type | Name | Description |
---|---|---|
RoleName | node | is the symbolic name of the node which is to be affected |
RoleName | target | is the symbolic name of the other node to which connectivity shall be impeded |
Returns
Type | Description |
---|---|
Task<Done> |
Enter(RoleName, String)
Enter the named barriers, one after the other, in the order given. Will throw an exception in case of timeouts or other errors.
Declaration
public void Enter(RoleName roleName, string name)
Parameters
Type | Name | Description |
---|---|---|
RoleName | roleName | |
String | name |
Enter(TimeSpan, RoleName, ImmutableList<String>)
Enter the named barriers, one after the other, in the order given. Will throw an exception in case of timeouts or other errors.
Declaration
public void Enter(TimeSpan timeout, RoleName roleName, ImmutableList<string> names)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeout | |
RoleName | roleName | |
System.Collections.Immutable.ImmutableList<String> | names |
Exit(RoleName, Int32)
Tell the actor system at the remote node to shut itself down. The node will also be removed, so that the remaining nodes may still pass subsequent barriers.
Declaration
public Task<Done> Exit(RoleName node, int exitValue)
Parameters
Type | Name | Description |
---|---|---|
RoleName | node | is the symbolic name of the node which is to be affected |
Int32 | exitValue | is the return code which shall be given to System.exit |
Returns
Type | Description |
---|---|
Task<Done> | TBD |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | TBD |
Get(ActorSystem)
Declaration
public static TestConductor Get(ActorSystem system)
Parameters
Type | Name | Description |
---|---|---|
ActorSystem | system |
Returns
Type | Description |
---|---|
TestConductor |
GetAddressFor(RoleName)
Declaration
public Task<Address> GetAddressFor(RoleName name)
Parameters
Type | Name | Description |
---|---|---|
RoleName | name |
Returns
Type | Description |
---|---|
Task<Address> |
GetNodes()
Obtain the list of remote host names currently registered.
Declaration
public Task<IEnumerable<RoleName>> GetNodes()
Returns
Type | Description |
---|---|
Task<IEnumerable<RoleName>> |
PassThrough(RoleName, RoleName, ThrottleTransportAdapter.Direction)
Switch the Helios pipeline of the remote support into pass through mode for sending and/or receiving.
====Note====
To use this feature you must activate the failure injector and throttler
transport adapters by specifying testTransport(on = true)
in your MultiNodeConfig.
Declaration
public Task<Done> PassThrough(RoleName node, RoleName target, ThrottleTransportAdapter.Direction direction)
Parameters
Type | Name | Description |
---|---|---|
RoleName | node | is the symbolic name of the node which is to be affected |
RoleName | target | is the symbolic name of the other node to which connectivity shall be impeded |
ThrottleTransportAdapter.Direction | direction | can be either |
Returns
Type | Description |
---|---|
Task<Done> |
RemoveNode(RoleName)
Remove a remote host from the list, so that the remaining nodes may still pass subsequent barriers. This must be done before the client connection breaks down in order to affect an "orderly" removal (i.e. without failing present and future barriers).
Declaration
public Task<Done> RemoveNode(RoleName node)
Parameters
Type | Name | Description |
---|---|---|
RoleName | node | is the symbolic name of the node which is to be removed |
Returns
Type | Description |
---|---|
Task<Done> |
Shutdown(RoleName, Boolean)
Tell the actor system at the remote node to shut itself down without awaiting termination of remote-deployed children. The node will also be removed, so that the remaining nodes may still pass subsequent barriers.
Declaration
public Task<Done> Shutdown(RoleName node, bool abort = false)
Parameters
Type | Name | Description |
---|---|---|
RoleName | node | is the symbolic name of the node which is to be affected |
Boolean | abort | TBD |
Returns
Type | Description |
---|---|
Task<Done> | TBD |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | TBD |
StartClient(RoleName, IPEndPoint)
Connect to the conductor on the given port (the host is taken from setting
akka.testconductor.host
). The connection is made asynchronously, but you
should await completion of the returned Future because that implies that
all expected participants of this test have successfully connected (i.e.
this is a first barrier in itself). The number of expected participants is
set in TestConductor.startController()
.
Declaration
public Task<Done> StartClient(RoleName name, IPEndPoint controllerAddr)
Parameters
Type | Name | Description |
---|---|---|
RoleName | name | |
IPEndPoint | controllerAddr |
Returns
Type | Description |
---|---|
Task<Done> |
StartController(Int32, RoleName, IPEndPoint)
Start the Controller, which in turn will
bind to a TCP port as specified in the akka.testconductor.port
config
property, where 0 denotes automatic allocation. Since the latter is
actually preferred, a Future[Int]
is returned which will be completed
with the port number actually chosen, so that this can then be communicated
to the players for their proper start-up.
This method also invokes Player.startClient, since it is expected that the conductor participates in barriers for overall coordination. The returned Future will only be completed once the client’s start-up finishes, which in fact waits for all other players to connect.
Declaration
public async Task<IPEndPoint> StartController(int participants, RoleName name, IPEndPoint controllerPort)
Parameters
Type | Name | Description |
---|---|---|
Int32 | participants | participants gives the number of participants which shall connect before any of their startClient() operations complete |
RoleName | name | |
IPEndPoint | controllerPort |
Returns
Type | Description |
---|---|
Task<IPEndPoint> |
Throttle(RoleName, RoleName, ThrottleTransportAdapter.Direction, Single)
Make the remoting pipeline on the node throttle data sent to or received
from the given remote peer. Throttling works by delaying packet submission
within the netty pipeline until the packet would have been completely sent
according to the given rate, the previous packet completion and the current
packet length. In case of large packets they are split up if the calculated
end pause would exceed akka.testconductor.packet-split-threshold
(roughly). All of this uses the system’s scheduler, which is not
terribly precise and will execute tasks later than they are schedule (even
on average), but that is countered by using the actual execution time for
determining how much to send, leading to the correct output rate, but with
increased latency.
====Note====
To use this feature you must activate the failure injector and throttler
transport adapters by specifying testTransport(on = true)
in your MultiNodeConfig.
Declaration
public Task<Done> Throttle(RoleName node, RoleName target, ThrottleTransportAdapter.Direction direction, float rateMBit)
Parameters
Type | Name | Description |
---|---|---|
RoleName | node | is the symbolic name of the node which is to be affected |
RoleName | target | is the symbolic name of the other node to which connectivity shall be throttled |
ThrottleTransportAdapter.Direction | direction | can be either |
Single | rateMBit | is the maximum data rate in MBit |
Returns
Type | Description |
---|---|
Task<Done> |