Class NetworkDisruption
java.lang.Object
org.elasticsearch.test.disruption.NetworkDisruption
- All Implemented Interfaces:
ServiceDisruptionScheme
public class NetworkDisruption extends java.lang.Object implements 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
Nested Classes Modifier and Type Class Description static class
NetworkDisruption.Bridge
Creates two partitions with symmetric failures and a bridge node that can connect to both of the partitionsstatic class
NetworkDisruption.DisruptedLinks
Represents a set of nodes with connections between nodes that are to be disruptedstatic class
NetworkDisruption.IsolateAllNodes
static class
NetworkDisruption.NetworkDelay
Simulates slow or congested network.static class
NetworkDisruption.NetworkLinkDisruptionType
Abstract class representing various types of network disruptions.static class
NetworkDisruption.TwoPartitions
Creates two partitions with symmetric failures -
Field Summary
Fields Modifier and Type Field Description protected boolean
activeDisruption
protected InternalTestCluster
cluster
static NetworkDisruption.NetworkLinkDisruptionType
DISCONNECT
Simulates a network disconnect.static NetworkDisruption.NetworkLinkDisruptionType
UNRESPONSIVE
Simulates an unresponsive target node by dropping requests sent from source to target node. -
Constructor Summary
Constructors Constructor Description NetworkDisruption(NetworkDisruption.DisruptedLinks disruptedLinks, NetworkDisruption.NetworkLinkDisruptionType networkLinkDisruptionType)
-
Method Summary
Modifier and Type Method Description void
applyToCluster(InternalTestCluster cluster)
void
applyToNode(java.lang.String node, InternalTestCluster cluster)
static void
ensureFullyConnectedCluster(InternalTestCluster cluster)
Ensures that all nodes in the cluster are connected to each other.void
ensureHealthy(InternalTestCluster cluster)
ensures the cluster is healthy after the disruptionprotected void
ensureNodeCount(InternalTestCluster cluster)
org.elasticsearch.common.unit.TimeValue
expectedTimeToHeal()
NetworkDisruption.DisruptedLinks
getDisruptedLinks()
NetworkDisruption.NetworkLinkDisruptionType
getNetworkLinkDisruptionType()
void
removeAndEnsureHealthy(InternalTestCluster cluster)
void
removeFromCluster(InternalTestCluster cluster)
void
removeFromNode(java.lang.String node1, InternalTestCluster cluster)
void
startDisrupting()
void
stopDisrupting()
void
testClusterClosed()
java.lang.String
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.common.unit.TimeValue expectedTimeToHeal()- Specified by:
expectedTimeToHeal
in interfaceServiceDisruptionScheme
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-