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 classNetworkDisruption.BridgeCreates two partitions with symmetric failures and a bridge node that can connect to both of the partitionsstatic classNetworkDisruption.DisruptedLinksRepresents a set of nodes with connections between nodes that are to be disruptedstatic classNetworkDisruption.IsolateAllNodesstatic classNetworkDisruption.NetworkDelaySimulates slow or congested network.static classNetworkDisruption.NetworkDisconnectSimulates a network disconnect.static classNetworkDisruption.NetworkLinkDisruptionTypeAbstract class representing various types of network disruptions.static classNetworkDisruption.NetworkUnresponsiveSimulates an unresponsive target node by dropping requests sent from source to target node.static classNetworkDisruption.TwoPartitionsCreates two partitions with symmetric failures -
Field Summary
Fields Modifier and Type Field Description protected booleanactiveDisruptionprotected InternalTestClustercluster -
Constructor Summary
Constructors Constructor Description NetworkDisruption(NetworkDisruption.DisruptedLinks disruptedLinks, NetworkDisruption.NetworkLinkDisruptionType networkLinkDisruptionType) -
Method Summary
Modifier and Type Method Description voidapplyToCluster(InternalTestCluster cluster)voidapplyToNode(java.lang.String node, InternalTestCluster cluster)static voidensureFullyConnectedCluster(InternalTestCluster cluster)Ensures that all nodes in the cluster are connected to each other.voidensureHealthy(InternalTestCluster cluster)ensures the cluster is healthy after the disruptionprotected voidensureNodeCount(InternalTestCluster cluster)org.elasticsearch.common.unit.TimeValueexpectedTimeToHeal()NetworkDisruption.DisruptedLinksgetDisruptedLinks()NetworkDisruption.NetworkLinkDisruptionTypegetNetworkLinkDisruptionType()voidremoveAndEnsureHealthy(InternalTestCluster cluster)voidremoveFromCluster(InternalTestCluster cluster)voidremoveFromNode(java.lang.String node1, InternalTestCluster cluster)voidstartDisrupting()voidstopDisrupting()voidtestClusterClosed()java.lang.StringtoString()
-
Field Details
-
cluster
-
activeDisruption
protected volatile boolean activeDisruption
-
-
Constructor Details
-
NetworkDisruption
public NetworkDisruption(NetworkDisruption.DisruptedLinks disruptedLinks, NetworkDisruption.NetworkLinkDisruptionType networkLinkDisruptionType)
-
-
Method Details
-
getDisruptedLinks
-
getNetworkLinkDisruptionType
-
applyToCluster
- Specified by:
applyToClusterin interfaceServiceDisruptionScheme
-
removeFromCluster
- Specified by:
removeFromClusterin interfaceServiceDisruptionScheme
-
removeAndEnsureHealthy
- Specified by:
removeAndEnsureHealthyin 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.NodeConnectionsServicewill eventually reconnect but it's handy to be able to ensure this happens faster -
ensureNodeCount
-
applyToNode
- Specified by:
applyToNodein interfaceServiceDisruptionScheme
-
removeFromNode
- Specified by:
removeFromNodein interfaceServiceDisruptionScheme
-
testClusterClosed
public void testClusterClosed()- Specified by:
testClusterClosedin interfaceServiceDisruptionScheme
-
startDisrupting
public void startDisrupting()- Specified by:
startDisruptingin interfaceServiceDisruptionScheme
-
stopDisrupting
public void stopDisrupting()- Specified by:
stopDisruptingin interfaceServiceDisruptionScheme
-
expectedTimeToHeal
public org.elasticsearch.common.unit.TimeValue expectedTimeToHeal()- Specified by:
expectedTimeToHealin interfaceServiceDisruptionScheme
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-