Search in sources :

Example 1 with SlowClusterStateProcessing

use of org.elasticsearch.test.disruption.SlowClusterStateProcessing in project elasticsearch by elastic.

the class DiscoveryWithServiceDisruptionsIT method testClusterFormingWithASlowNode.

public void testClusterFormingWithASlowNode() throws Exception {
    configureCluster(3, null, 2);
    SlowClusterStateProcessing disruption = new SlowClusterStateProcessing(random(), 0, 0, 1000, 2000);
    // don't wait for initial state, wat want to add the disruption while the cluster is forming..
    internalCluster().startNodes(3, Settings.builder().put(DiscoverySettings.PUBLISH_TIMEOUT_SETTING.getKey(), "3s").build());
    logger.info("applying disruption while cluster is forming ...");
    internalCluster().setDisruptionScheme(disruption);
    disruption.startDisrupting();
    ensureStableCluster(3);
}
Also used : SlowClusterStateProcessing(org.elasticsearch.test.disruption.SlowClusterStateProcessing)

Example 2 with SlowClusterStateProcessing

use of org.elasticsearch.test.disruption.SlowClusterStateProcessing in project elasticsearch by elastic.

the class DiscoveryWithServiceDisruptionsIT method addRandomDisruptionScheme.

private 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 = new NetworkUnresponsive();
            break;
        case 1:
            disruptionType = new NetworkDisconnect();
            break;
        case 2:
            disruptionType = 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.elasticsearch.test.disruption.SlowClusterStateProcessing) NetworkLinkDisruptionType(org.elasticsearch.test.disruption.NetworkDisruption.NetworkLinkDisruptionType) DisruptedLinks(org.elasticsearch.test.disruption.NetworkDisruption.DisruptedLinks) NetworkUnresponsive(org.elasticsearch.test.disruption.NetworkDisruption.NetworkUnresponsive) ServiceDisruptionScheme(org.elasticsearch.test.disruption.ServiceDisruptionScheme) NetworkDisruption(org.elasticsearch.test.disruption.NetworkDisruption) NetworkDisconnect(org.elasticsearch.test.disruption.NetworkDisruption.NetworkDisconnect)

Aggregations

SlowClusterStateProcessing (org.elasticsearch.test.disruption.SlowClusterStateProcessing)2 NetworkDisruption (org.elasticsearch.test.disruption.NetworkDisruption)1 DisruptedLinks (org.elasticsearch.test.disruption.NetworkDisruption.DisruptedLinks)1 NetworkDisconnect (org.elasticsearch.test.disruption.NetworkDisruption.NetworkDisconnect)1 NetworkLinkDisruptionType (org.elasticsearch.test.disruption.NetworkDisruption.NetworkLinkDisruptionType)1 NetworkUnresponsive (org.elasticsearch.test.disruption.NetworkDisruption.NetworkUnresponsive)1 ServiceDisruptionScheme (org.elasticsearch.test.disruption.ServiceDisruptionScheme)1