Skip to content

Commit

Permalink
Fix IndexFoldersDeletionListenerIT (elastic#66597)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlrx committed Jan 4, 2021
1 parent 7cd00ba commit 955c040
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,24 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
return plugins;
}

@Override
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder()
.put(super.nodeSettings(nodeOrdinal))
// prevent shards to move around after they got assigned the first time
.put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE)
.build();
}

public void testListenersInvokedWhenIndexIsDeleted() throws Exception {
final String masterNode = internalCluster().startMasterOnlyNode();
internalCluster().startDataOnlyNodes(2);
ensureStableCluster(2 + 1, masterNode);

final String indexName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT);
createIndex(indexName, Settings.builder()
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 2 * between(1, 2))
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, between(0, 1))
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 2)
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
.build());

final NumShards numShards = getNumShards(indexName);
Expand Down Expand Up @@ -129,7 +138,7 @@ public void testListenersInvokedWhenIndexIsRelocated() throws Exception {

final String indexName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT);
createIndex(indexName, Settings.builder()
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4 * between(1, 2))
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4)
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, between(0, 1))
.build());

Expand Down Expand Up @@ -192,7 +201,7 @@ public void testListenersInvokedWhenIndexIsDangling() throws Exception {

final String indexName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT);
createIndex(indexName, Settings.builder()
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4 * between(1, 2))
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4)
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, between(0, 1))
.build());

Expand Down

0 comments on commit 955c040

Please sign in to comment.