Class NetworkDisruption.NetworkDelay
java.lang.Object
org.opensearch.test.disruption.NetworkDisruption.NetworkLinkDisruptionType
org.opensearch.test.disruption.NetworkDisruption.NetworkDelay
- Enclosing class:
NetworkDisruption
public static class NetworkDisruption.NetworkDelay
extends NetworkDisruption.NetworkLinkDisruptionType
Simulates slow or congested network. Delivery of requests that are sent from source to target node are delayed by a configurable
time amount.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic org.opensearch.common.unit.TimeValuestatic org.opensearch.common.unit.TimeValue -
Constructor Summary
ConstructorsConstructorDescriptionNetworkDelay(org.opensearch.common.unit.TimeValue delay) Delays requests by a fixed time value. -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyDisruption(MockTransportService sourceTransportService, MockTransportService targetTransportService) Applies network disruption for requests send from the node represented by the source transport service to the node represented by the target transport service.org.opensearch.common.unit.TimeValueReturns expected time to heal after disruption has been removed.Delays requests by a random but fixed time value betweenDEFAULT_DELAY_MINandDEFAULT_DELAY_MAX.random(Random random, org.opensearch.common.unit.TimeValue delayMin, org.opensearch.common.unit.TimeValue delayMax) Delays requests by a random but fixed time value between delayMin and delayMax.toString()Methods inherited from class org.opensearch.test.disruption.NetworkDisruption.NetworkLinkDisruptionType
removeDisruption
-
Field Details
-
DEFAULT_DELAY_MIN
public static org.opensearch.common.unit.TimeValue DEFAULT_DELAY_MIN -
DEFAULT_DELAY_MAX
public static org.opensearch.common.unit.TimeValue DEFAULT_DELAY_MAX
-
-
Constructor Details
-
NetworkDelay
public NetworkDelay(org.opensearch.common.unit.TimeValue delay) Delays requests by a fixed time value.- Parameters:
delay- time to delay requests
-
-
Method Details
-
random
Delays requests by a random but fixed time value betweenDEFAULT_DELAY_MINandDEFAULT_DELAY_MAX.- Parameters:
random- instance to use for randomization of delay
-
random
public static NetworkDisruption.NetworkDelay random(Random random, org.opensearch.common.unit.TimeValue delayMin, org.opensearch.common.unit.TimeValue delayMax) Delays requests by a random but fixed time value between delayMin and delayMax.- Parameters:
random- instance to use for randomization of delaydelayMin- minimum delaydelayMax- maximum delay
-
applyDisruption
public void applyDisruption(MockTransportService sourceTransportService, MockTransportService targetTransportService) Description copied from class:NetworkDisruption.NetworkLinkDisruptionTypeApplies network disruption for requests send from the node represented by the source transport service to the node represented by the target transport service.- Specified by:
applyDisruptionin classNetworkDisruption.NetworkLinkDisruptionType- Parameters:
sourceTransportService- source transport service from which requests are senttargetTransportService- target transport service to which requests are sent
-
expectedTimeToHeal
public org.opensearch.common.unit.TimeValue expectedTimeToHeal()Description copied from class:NetworkDisruption.NetworkLinkDisruptionTypeReturns expected time to heal after disruption has been removed. Defaults to instant healing.- Overrides:
expectedTimeToHealin classNetworkDisruption.NetworkLinkDisruptionType
-
toString
-