@@ -75,27 +75,25 @@ public void testConditionMet() {
75
75
Map <String , String > requires = AllocateActionTests .randomMap (1 , 5 );
76
76
Settings .Builder existingSettings = Settings .builder ().put (IndexMetadata .SETTING_VERSION_CREATED , Version .CURRENT .id )
77
77
.put (IndexMetadata .SETTING_INDEX_UUID , index .getUUID ());
78
- Settings .Builder expectedSettings = Settings .builder ();
79
78
Settings .Builder node1Settings = Settings .builder ();
80
79
Settings .Builder node2Settings = Settings .builder ();
81
80
includes .forEach ((k , v ) -> {
82
81
existingSettings .put (IndexMetadata .INDEX_ROUTING_INCLUDE_GROUP_SETTING .getKey () + k , v );
83
- expectedSettings .put (IndexMetadata .INDEX_ROUTING_INCLUDE_GROUP_SETTING .getKey () + k , v );
84
82
node1Settings .put (Node .NODE_ATTRIBUTES .getKey () + k , v );
85
83
});
86
84
excludes .forEach ((k , v ) -> {
87
85
existingSettings .put (IndexMetadata .INDEX_ROUTING_EXCLUDE_GROUP_SETTING .getKey () + k , v );
88
- expectedSettings .put (IndexMetadata .INDEX_ROUTING_EXCLUDE_GROUP_SETTING .getKey () + k , v );
89
86
});
90
87
requires .forEach ((k , v ) -> {
91
88
existingSettings .put (IndexMetadata .INDEX_ROUTING_REQUIRE_GROUP_SETTING .getKey () + k , v );
92
- expectedSettings .put (IndexMetadata .INDEX_ROUTING_REQUIRE_GROUP_SETTING .getKey () + k , v );
93
89
node1Settings .put (Node .NODE_ATTRIBUTES .getKey () + k , v );
94
90
});
95
91
96
92
IndexRoutingTable .Builder indexRoutingTable = IndexRoutingTable .builder (index )
97
93
.addShard (TestShardRouting .newShardRouting (new ShardId (index , 0 ), "node1" , true , ShardRoutingState .STARTED ));
98
94
95
+ logger .info ("running test with routing configurations:\n \t includes: [{}]\n \t excludes: [{}]\n \t requires: [{}]" ,
96
+ includes , excludes , requires );
99
97
AllocationRoutedStep step = createRandomInstance ();
100
98
assertAllocateStatus (index , 1 , 0 , step , existingSettings , node1Settings , node2Settings , indexRoutingTable ,
101
99
new ClusterStateWaitStep .Result (true , null ));
@@ -174,12 +172,10 @@ public void testConditionNotMetDueToRelocation() {
174
172
.put (IndexMetadata .SETTING_VERSION_CREATED , Version .CURRENT .id )
175
173
.put (IndexMetadata .INDEX_ROUTING_REQUIRE_GROUP_PREFIX + "._id" , "node1" )
176
174
.put (IndexMetadata .SETTING_INDEX_UUID , index .getUUID ());
177
- Settings .Builder expectedSettings = Settings .builder ();
178
175
Settings .Builder node1Settings = Settings .builder ();
179
176
Settings .Builder node2Settings = Settings .builder ();
180
177
requires .forEach ((k , v ) -> {
181
178
existingSettings .put (IndexMetadata .INDEX_ROUTING_REQUIRE_GROUP_SETTING .getKey () + k , v );
182
- expectedSettings .put (IndexMetadata .INDEX_ROUTING_REQUIRE_GROUP_SETTING .getKey () + k , v );
183
179
node1Settings .put (Node .NODE_ATTRIBUTES .getKey () + k , v );
184
180
});
185
181
boolean primaryOnNode1 = randomBoolean ();
@@ -206,28 +202,26 @@ public void testExecuteAllocateNotComplete() throws Exception {
206
202
() -> AllocateActionTests .randomMap (1 , 5 ));
207
203
Settings .Builder existingSettings = Settings .builder ().put (IndexMetadata .SETTING_VERSION_CREATED , Version .CURRENT .id )
208
204
.put (IndexMetadata .SETTING_INDEX_UUID , index .getUUID ());
209
- Settings .Builder expectedSettings = Settings .builder ();
210
205
Settings .Builder node1Settings = Settings .builder ();
211
206
Settings .Builder node2Settings = Settings .builder ();
212
207
includes .forEach ((k , v ) -> {
213
208
existingSettings .put (IndexMetadata .INDEX_ROUTING_INCLUDE_GROUP_SETTING .getKey () + k , v );
214
- expectedSettings .put (IndexMetadata .INDEX_ROUTING_INCLUDE_GROUP_SETTING .getKey () + k , v );
215
209
node1Settings .put (Node .NODE_ATTRIBUTES .getKey () + k , v );
216
210
});
217
211
excludes .forEach ((k , v ) -> {
218
212
existingSettings .put (IndexMetadata .INDEX_ROUTING_EXCLUDE_GROUP_SETTING .getKey () + k , v );
219
- expectedSettings .put (IndexMetadata .INDEX_ROUTING_EXCLUDE_GROUP_SETTING .getKey () + k , v );
220
213
});
221
214
requires .forEach ((k , v ) -> {
222
215
existingSettings .put (IndexMetadata .INDEX_ROUTING_REQUIRE_GROUP_SETTING .getKey () + k , v );
223
- expectedSettings .put (IndexMetadata .INDEX_ROUTING_REQUIRE_GROUP_SETTING .getKey () + k , v );
224
216
node1Settings .put (Node .NODE_ATTRIBUTES .getKey () + k , v );
225
217
});
226
218
227
219
IndexRoutingTable .Builder indexRoutingTable = IndexRoutingTable .builder (index )
228
220
.addShard (TestShardRouting .newShardRouting (new ShardId (index , 0 ), "node1" , true , ShardRoutingState .STARTED ))
229
221
.addShard (TestShardRouting .newShardRouting (new ShardId (index , 1 ), "node2" , true , ShardRoutingState .STARTED ));
230
222
223
+ logger .info ("running test with routing configurations:\n \t includes: [{}]\n \t excludes: [{}]\n \t requires: [{}]" ,
224
+ includes , excludes , requires );
231
225
AllocationRoutedStep step = createRandomInstance ();
232
226
assertAllocateStatus (index , 2 , 0 , step , existingSettings , node1Settings , node2Settings , indexRoutingTable ,
233
227
new ClusterStateWaitStep .Result (false , allShardsActiveAllocationInfo (0 , 1 )));
@@ -243,21 +237,17 @@ public void testExecuteAllocateNotCompleteOnlyOneCopyAllocated() throws Exceptio
243
237
() -> AllocateActionTests .randomMap (1 , 5 ));
244
238
Settings .Builder existingSettings = Settings .builder ().put (IndexMetadata .SETTING_VERSION_CREATED , Version .CURRENT .id )
245
239
.put (IndexMetadata .SETTING_INDEX_UUID , index .getUUID ());
246
- Settings .Builder expectedSettings = Settings .builder ();
247
240
Settings .Builder node1Settings = Settings .builder ();
248
241
Settings .Builder node2Settings = Settings .builder ();
249
242
includes .forEach ((k , v ) -> {
250
243
existingSettings .put (IndexMetadata .INDEX_ROUTING_INCLUDE_GROUP_SETTING .getKey () + k , v );
251
- expectedSettings .put (IndexMetadata .INDEX_ROUTING_INCLUDE_GROUP_SETTING .getKey () + k , v );
252
244
node1Settings .put (Node .NODE_ATTRIBUTES .getKey () + k , v );
253
245
});
254
246
excludes .forEach ((k , v ) -> {
255
247
existingSettings .put (IndexMetadata .INDEX_ROUTING_EXCLUDE_GROUP_SETTING .getKey () + k , v );
256
- expectedSettings .put (IndexMetadata .INDEX_ROUTING_EXCLUDE_GROUP_SETTING .getKey () + k , v );
257
248
});
258
249
requires .forEach ((k , v ) -> {
259
250
existingSettings .put (IndexMetadata .INDEX_ROUTING_REQUIRE_GROUP_SETTING .getKey () + k , v );
260
- expectedSettings .put (IndexMetadata .INDEX_ROUTING_REQUIRE_GROUP_SETTING .getKey () + k , v );
261
251
node1Settings .put (Node .NODE_ATTRIBUTES .getKey () + k , v );
262
252
});
263
253
@@ -267,7 +257,10 @@ public void testExecuteAllocateNotCompleteOnlyOneCopyAllocated() throws Exceptio
267
257
.addShard (TestShardRouting .newShardRouting (new ShardId (index , 0 ), "node2" , primaryOnNode1 == false ,
268
258
ShardRoutingState .STARTED ));
269
259
260
+
270
261
AllocationRoutedStep step = new AllocationRoutedStep (randomStepKey (), randomStepKey ());
262
+ logger .info ("running test with routing configurations:\n \t includes: [{}]\n \t excludes: [{}]\n \t requires: [{}]" ,
263
+ includes , excludes , requires );
271
264
assertAllocateStatus (index , 2 , 0 , step , existingSettings , node1Settings , node2Settings , indexRoutingTable ,
272
265
new ClusterStateWaitStep .Result (false , allShardsActiveAllocationInfo (0 , 1 )));
273
266
}
@@ -282,21 +275,17 @@ public void testExecuteAllocateUnassigned() throws Exception {
282
275
() -> AllocateActionTests .randomMap (1 , 5 ));
283
276
Settings .Builder existingSettings = Settings .builder ().put (IndexMetadata .SETTING_VERSION_CREATED , Version .CURRENT .id )
284
277
.put (IndexMetadata .SETTING_INDEX_UUID , index .getUUID ());
285
- Settings .Builder expectedSettings = Settings .builder ();
286
278
Settings .Builder node1Settings = Settings .builder ();
287
279
Settings .Builder node2Settings = Settings .builder ();
288
280
includes .forEach ((k , v ) -> {
289
281
existingSettings .put (IndexMetadata .INDEX_ROUTING_INCLUDE_GROUP_SETTING .getKey () + k , v );
290
- expectedSettings .put (IndexMetadata .INDEX_ROUTING_INCLUDE_GROUP_SETTING .getKey () + k , v );
291
282
node1Settings .put (Node .NODE_ATTRIBUTES .getKey () + k , v );
292
283
});
293
284
excludes .forEach ((k , v ) -> {
294
285
existingSettings .put (IndexMetadata .INDEX_ROUTING_EXCLUDE_GROUP_SETTING .getKey () + k , v );
295
- expectedSettings .put (IndexMetadata .INDEX_ROUTING_EXCLUDE_GROUP_SETTING .getKey () + k , v );
296
286
});
297
287
requires .forEach ((k , v ) -> {
298
288
existingSettings .put (IndexMetadata .INDEX_ROUTING_REQUIRE_GROUP_SETTING .getKey () + k , v );
299
- expectedSettings .put (IndexMetadata .INDEX_ROUTING_REQUIRE_GROUP_SETTING .getKey () + k , v );
300
289
node1Settings .put (Node .NODE_ATTRIBUTES .getKey () + k , v );
301
290
});
302
291
@@ -305,6 +294,8 @@ public void testExecuteAllocateUnassigned() throws Exception {
305
294
.addShard (TestShardRouting .newShardRouting (new ShardId (index , 1 ), null , null , true , ShardRoutingState .UNASSIGNED ,
306
295
new UnassignedInfo (randomFrom (Reason .values ()), "the shard is intentionally unassigned" )));
307
296
297
+ logger .info ("running test with routing configurations:\n \t includes: [{}]\n \t excludes: [{}]\n \t requires: [{}]" ,
298
+ includes , excludes , requires );
308
299
AllocationRoutedStep step = createRandomInstance ();
309
300
assertAllocateStatus (index , 2 , 0 , step , existingSettings , node1Settings , node2Settings , indexRoutingTable ,
310
301
new ClusterStateWaitStep .Result (false , waitingForActiveShardsAllocationInfo (0 )));
@@ -329,15 +320,10 @@ public void testExecuteAllocateUnassigned() throws Exception {
329
320
*/
330
321
public void testExecuteReplicasNotAllocatedOnSingleNode () {
331
322
Index index = new Index (randomAlphaOfLengthBetween (1 , 20 ), randomAlphaOfLengthBetween (1 , 20 ));
332
- Map <String , String > requires = Collections .singletonMap ("_name" , "node1" );
333
323
Settings .Builder existingSettings = Settings .builder ().put (IndexMetadata .SETTING_VERSION_CREATED , Version .CURRENT .id )
334
324
.put (IndexMetadata .SETTING_INDEX_UUID , index .getUUID ());
335
- Settings .Builder expectedSettings = Settings .builder ();
336
325
Settings .Builder node1Settings = Settings .builder ();
337
326
Settings .Builder node2Settings = Settings .builder ();
338
- requires .forEach ((k , v ) -> {
339
- expectedSettings .put (IndexMetadata .INDEX_ROUTING_REQUIRE_GROUP_SETTING .getKey () + k , v );
340
- });
341
327
342
328
IndexRoutingTable .Builder indexRoutingTable = IndexRoutingTable .builder (index )
343
329
.addShard (TestShardRouting .newShardRouting (new ShardId (index , 0 ), "node1" , true , ShardRoutingState .STARTED ))
0 commit comments