@@ -68,15 +68,24 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
68
68
return plugins ;
69
69
}
70
70
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
+
71
80
public void testListenersInvokedWhenIndexIsDeleted () throws Exception {
72
81
final String masterNode = internalCluster ().startMasterOnlyNode ();
73
82
internalCluster ().startDataOnlyNodes (2 );
74
83
ensureStableCluster (2 + 1 , masterNode );
75
84
76
85
final String indexName = randomAlphaOfLength (10 ).toLowerCase (Locale .ROOT );
77
86
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 )
80
89
.build ());
81
90
82
91
final NumShards numShards = getNumShards (indexName );
@@ -129,7 +138,7 @@ public void testListenersInvokedWhenIndexIsRelocated() throws Exception {
129
138
130
139
final String indexName = randomAlphaOfLength (10 ).toLowerCase (Locale .ROOT );
131
140
createIndex (indexName , Settings .builder ()
132
- .put (IndexMetadata .SETTING_NUMBER_OF_SHARDS , 4 * between ( 1 , 2 ) )
141
+ .put (IndexMetadata .SETTING_NUMBER_OF_SHARDS , 4 )
133
142
.put (IndexMetadata .SETTING_NUMBER_OF_REPLICAS , between (0 , 1 ))
134
143
.build ());
135
144
@@ -192,7 +201,7 @@ public void testListenersInvokedWhenIndexIsDangling() throws Exception {
192
201
193
202
final String indexName = randomAlphaOfLength (10 ).toLowerCase (Locale .ROOT );
194
203
createIndex (indexName , Settings .builder ()
195
- .put (IndexMetadata .SETTING_NUMBER_OF_SHARDS , 4 * between ( 1 , 2 ) )
204
+ .put (IndexMetadata .SETTING_NUMBER_OF_SHARDS , 4 )
196
205
.put (IndexMetadata .SETTING_NUMBER_OF_REPLICAS , between (0 , 1 ))
197
206
.build ());
198
207
0 commit comments