Fix test bug in o.e.a.s.b.n.TransportBroadcastByNodeActionTests
This commit fixes a test bug in o.e.a.s.b.n.TransportBroadcastByNodeActionTests. Namely, the randomized test allowed for the creation of cluster states that allocated indices having zero shards. This ultimately surfaced in a NoSuchElementException when attempting to iterate over the nonexistent shards. The fix is merely to draw the random number of shards from 1 to 10 instead of 0 to 10.
This commit is contained in:
parent
30bd46ab25
commit
57c5efacf6
|
@ -206,7 +206,7 @@ public class TransportBroadcastByNodeActionTests extends ESTestCase {
|
|||
for (int i = 0; i < numberOfNodes; i++) {
|
||||
final DiscoveryNode node = newNode(i);
|
||||
discoBuilder = discoBuilder.put(node);
|
||||
int numberOfShards = randomIntBetween(0, 10);
|
||||
int numberOfShards = randomIntBetween(1, 10);
|
||||
for (int j = 0; j < numberOfShards; j++) {
|
||||
final ShardId shardId = new ShardId(index, ++shardIndex);
|
||||
ShardRouting shard = TestShardRouting.newShardRouting(index, shardId.getId(), node.id(), true, ShardRoutingState.STARTED, 1);
|
||||
|
|
Loading…
Reference in New Issue