[TEST] Ensure stable cluster before disabling licensing in testEnableDisableBehaviour

If the cluster is still making cluster state updates while disabling the license, cluster state updates might not go through,
triggering an assertion failure at the end of the test that checks if all cluster states have been applied.

relates elastic/x-pack-elasticsearch#1627

Original commit: elastic/x-pack-elasticsearch@e11863fd02
This commit is contained in:
Yannick Welsch 2017-07-11 11:46:17 +02:00
parent 16f2de017d
commit 6b02197ca1
1 changed files with 4 additions and 0 deletions

View File

@ -32,6 +32,7 @@ import org.elasticsearch.client.ResponseException;
import org.elasticsearch.client.transport.NoNodeAvailableException;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.cluster.metadata.MappingMetaData;
import org.elasticsearch.cluster.routing.ShardRoutingState;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.network.NetworkModule;
import org.elasticsearch.common.settings.SecureString;
@ -159,6 +160,9 @@ public class LicensingTests extends SecurityIntegTestCase {
assertEquals(DocWriteResponse.Result.CREATED, indexResponse.getResult());
refresh();
// wait for all replicas to be started (to make sure that there are no more cluster state updates when we disable licensing)
assertBusy(() -> assertTrue(client().admin().cluster().prepareState().get().getState().routingTable()
.shardsWithState(ShardRoutingState.INITIALIZING).isEmpty()));
Client client = internalCluster().transportClient();