Class NetworkDisruption
java.lang.Object
org.elasticsearch.test.disruption.NetworkDisruption
- All Implemented Interfaces:
ServiceDisruptionScheme
Network disruptions are modeled using two components:
1) the
NetworkDisruption.DisruptedLinks
represents the links in the network that are to be disrupted
2) the NetworkDisruption.NetworkLinkDisruptionType
represents the failure mode that is to be applied to the links-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Creates two partitions with symmetric failures and a bridge node that can connect to both of the partitionsstatic class
Represents a set of nodes with connections between nodes that are to be disruptedstatic class
static class
Simulates slow or congested network.static class
Abstract class representing various types of network disruptions.static class
Creates two partitions with symmetric failures -
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected InternalTestCluster
static final NetworkDisruption.NetworkLinkDisruptionType
Simulates a network disconnect.static final NetworkDisruption.NetworkLinkDisruptionType
Simulates an unresponsive target node by dropping requests sent from source to target node. -
Constructor Summary
ConstructorDescriptionNetworkDisruption
(NetworkDisruption.DisruptedLinks disruptedLinks, NetworkDisruption.NetworkLinkDisruptionType networkLinkDisruptionType) -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyToCluster
(InternalTestCluster testCluster) void
applyToNode
(String node, InternalTestCluster testCluster) static void
Ensures that all nodes in the cluster are connected to each other.void
ensureHealthy
(InternalTestCluster testCluster) ensures the cluster is healthy after the disruptionprotected void
ensureNodeCount
(InternalTestCluster testCluster) org.elasticsearch.core.TimeValue
void
removeAndEnsureHealthy
(InternalTestCluster testCluster) void
removeFromCluster
(InternalTestCluster testCluster) void
removeFromNode
(String node1, InternalTestCluster testCluster) void
void
void
toString()
-
Field Details
-
cluster
-
activeDisruption
protected volatile boolean activeDisruption -
DISCONNECT
Simulates a network disconnect. Sending a request from source to target node throws aConnectTransportException
. -
UNRESPONSIVE
Simulates an unresponsive target node by dropping requests sent from source to target node.
-
-
Constructor Details
-
NetworkDisruption
public NetworkDisruption(NetworkDisruption.DisruptedLinks disruptedLinks, NetworkDisruption.NetworkLinkDisruptionType networkLinkDisruptionType)
-
-
Method Details
-
getDisruptedLinks
-
getNetworkLinkDisruptionType
-
applyToCluster
- Specified by:
applyToCluster
in interfaceServiceDisruptionScheme
-
removeFromCluster
- Specified by:
removeFromCluster
in interfaceServiceDisruptionScheme
-
removeAndEnsureHealthy
- Specified by:
removeAndEnsureHealthy
in interfaceServiceDisruptionScheme
-
ensureHealthy
ensures the cluster is healthy after the disruption -
ensureFullyConnectedCluster
Ensures that all nodes in the cluster are connected to each other. Some network disruptions may leave nodes that are not the master disconnected from each other.NodeConnectionsService
will eventually reconnect but it's handy to be able to ensure this happens faster -
ensureNodeCount
-
applyToNode
- Specified by:
applyToNode
in interfaceServiceDisruptionScheme
-
removeFromNode
- Specified by:
removeFromNode
in interfaceServiceDisruptionScheme
-
testClusterClosed
public void testClusterClosed()- Specified by:
testClusterClosed
in interfaceServiceDisruptionScheme
-
startDisrupting
public void startDisrupting()- Specified by:
startDisrupting
in interfaceServiceDisruptionScheme
-
stopDisrupting
public void stopDisrupting()- Specified by:
stopDisrupting
in interfaceServiceDisruptionScheme
-
expectedTimeToHeal
public org.elasticsearch.core.TimeValue expectedTimeToHeal()- Specified by:
expectedTimeToHeal
in interfaceServiceDisruptionScheme
-
toString
-