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) theNetworkDisruption.DisruptedLinksrepresents the links in the network that are to be disrupted 2) theNetworkDisruption.NetworkLinkDisruptionTyperepresents 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)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 Detail
-
cluster
protected volatile InternalTestCluster cluster
-
activeDisruption
protected volatile boolean activeDisruption
-
-
Constructor Detail
-
NetworkDisruption
public NetworkDisruption(NetworkDisruption.DisruptedLinks disruptedLinks, NetworkDisruption.NetworkLinkDisruptionType networkLinkDisruptionType)
-
-
Method Detail
-
getDisruptedLinks
public NetworkDisruption.DisruptedLinks getDisruptedLinks()
-
getNetworkLinkDisruptionType
public NetworkDisruption.NetworkLinkDisruptionType getNetworkLinkDisruptionType()
-
applyToCluster
public void applyToCluster(InternalTestCluster cluster)
- Specified by:
applyToClusterin interfaceServiceDisruptionScheme
-
removeFromCluster
public void removeFromCluster(InternalTestCluster cluster)
- Specified by:
removeFromClusterin interfaceServiceDisruptionScheme
-
removeAndEnsureHealthy
public void removeAndEnsureHealthy(InternalTestCluster cluster)
- Specified by:
removeAndEnsureHealthyin interfaceServiceDisruptionScheme
-
ensureHealthy
public void ensureHealthy(InternalTestCluster cluster)
ensures the cluster is healthy after the disruption
-
ensureFullyConnectedCluster
public static void ensureFullyConnectedCluster(InternalTestCluster cluster)
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
protected void ensureNodeCount(InternalTestCluster cluster)
-
applyToNode
public void applyToNode(java.lang.String node, InternalTestCluster cluster)- Specified by:
applyToNodein interfaceServiceDisruptionScheme
-
removeFromNode
public void removeFromNode(java.lang.String node1, InternalTestCluster cluster)- 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 TimeValue expectedTimeToHeal()
- Specified by:
expectedTimeToHealin interfaceServiceDisruptionScheme
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-