Skip to content

Commit cffc614

Browse files
authored
Fix IndexFoldersDeletionListenerIT (#66597) (#66917)
Closes #66571
1 parent 5cff84f commit cffc614

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

server/src/internalClusterTest/java/org/elasticsearch/plugins/IndexFoldersDeletionListenerIT.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,24 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
6868
return plugins;
6969
}
7070

71+
@Override
72+
protected Settings nodeSettings(int nodeOrdinal) {
73+
return Settings.builder()
74+
.put(super.nodeSettings(nodeOrdinal))
75+
// prevent shards to move around after they got assigned the first time
76+
.put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE)
77+
.build();
78+
}
79+
7180
public void testListenersInvokedWhenIndexIsDeleted() throws Exception {
7281
final String masterNode = internalCluster().startMasterOnlyNode();
7382
internalCluster().startDataOnlyNodes(2);
7483
ensureStableCluster(2 + 1, masterNode);
7584

7685
final String indexName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT);
7786
createIndex(indexName, Settings.builder()
78-
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 2 * between(1, 2))
79-
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, between(0, 1))
87+
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 2)
88+
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
8089
.build());
8190

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

130139
final String indexName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT);
131140
createIndex(indexName, Settings.builder()
132-
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4 * between(1, 2))
141+
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4)
133142
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, between(0, 1))
134143
.build());
135144

@@ -192,7 +201,7 @@ public void testListenersInvokedWhenIndexIsDangling() throws Exception {
192201

193202
final String indexName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT);
194203
createIndex(indexName, Settings.builder()
195-
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4 * between(1, 2))
204+
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 4)
196205
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, between(0, 1))
197206
.build());
198207

0 commit comments

Comments
 (0)