Search in sources :

Example 1 with DisruptedLinks

use of org.opensearch.test.disruption.NetworkDisruption.DisruptedLinks in project OpenSearch by opensearch-project.

the class AbstractDisruptionTestCase method addRandomDisruptionScheme.

public ServiceDisruptionScheme addRandomDisruptionScheme() {
    // TODO: add partial partitions
    final DisruptedLinks disruptedLinks;
    if (randomBoolean()) {
        disruptedLinks = TwoPartitions.random(random(), internalCluster().getNodeNames());
    } else {
        disruptedLinks = Bridge.random(random(), internalCluster().getNodeNames());
    }
    final NetworkLinkDisruptionType disruptionType;
    switch(randomInt(2)) {
        case 0:
            disruptionType = NetworkDisruption.UNRESPONSIVE;
            break;
        case 1:
            disruptionType = NetworkDisruption.DISCONNECT;
            break;
        case 2:
            disruptionType = NetworkDisruption.NetworkDelay.random(random());
            break;
        default:
            throw new IllegalArgumentException();
    }
    final ServiceDisruptionScheme scheme;
    if (rarely()) {
        scheme = new SlowClusterStateProcessing(random());
    } else {
        scheme = new NetworkDisruption(disruptedLinks, disruptionType);
    }
    setDisruptionScheme(scheme);
    return scheme;
}
Also used : SlowClusterStateProcessing(org.opensearch.test.disruption.SlowClusterStateProcessing) NetworkLinkDisruptionType(org.opensearch.test.disruption.NetworkDisruption.NetworkLinkDisruptionType) DisruptedLinks(org.opensearch.test.disruption.NetworkDisruption.DisruptedLinks) ServiceDisruptionScheme(org.opensearch.test.disruption.ServiceDisruptionScheme) NetworkDisruption(org.opensearch.test.disruption.NetworkDisruption)

Aggregations

NetworkDisruption (org.opensearch.test.disruption.NetworkDisruption)1 DisruptedLinks (org.opensearch.test.disruption.NetworkDisruption.DisruptedLinks)1 NetworkLinkDisruptionType (org.opensearch.test.disruption.NetworkDisruption.NetworkLinkDisruptionType)1 ServiceDisruptionScheme (org.opensearch.test.disruption.ServiceDisruptionScheme)1 SlowClusterStateProcessing (org.opensearch.test.disruption.SlowClusterStateProcessing)1