@@ -120,7 +120,7 @@ public void setup() {
120
120
rollupIndex = "rollup-" + sourceIndex ;
121
121
startTime = randomLongBetween (946769284000L , 1607470084000L ); // random date between 2000-2020
122
122
docCount = randomIntBetween (10 , 9000 );
123
- numOfShards = 4 ; // randomIntBetween(1, 4);
123
+ numOfShards = randomIntBetween (1 , 4 );
124
124
numOfReplicas = 0 ; // Since this is a single node, we cannot have replicas
125
125
126
126
// Values for keyword dimensions
@@ -356,7 +356,8 @@ public void testCancelRollupIndexer() throws IOException {
356
356
IndicesService indexServices = getInstanceFromNode (IndicesService .class );
357
357
Index srcIndex = resolveIndex (sourceIndex );
358
358
IndexService indexService = indexServices .indexServiceSafe (srcIndex );
359
- IndexShard shard = indexService .getShard (0 );
359
+ int shardNum = randomIntBetween (0 , numOfShards - 1 );
360
+ IndexShard shard = indexService .getShard (shardNum );
360
361
RollupShardStatus status = new RollupShardStatus (shard .shardId ());
361
362
362
363
// re-use source index as temp index for test
@@ -373,7 +374,7 @@ public void testCancelRollupIndexer() throws IOException {
373
374
status .setCancelled ();
374
375
375
376
TaskCancelledException exception = expectThrows (TaskCancelledException .class , () -> indexer .execute ());
376
- assertThat (exception .getMessage (), equalTo ("Shard [" + sourceIndex + "][0 ] rollup cancelled" ));
377
+ assertThat (exception .getMessage (), equalTo ("Shard [" + sourceIndex + "][" + shardNum + " ] rollup cancelled" ));
377
378
}
378
379
379
380
public void testRollupBulkFailed () throws IOException {
0 commit comments