Skip to content

Commit

Permalink
Fix occasional failure in deprecation test (#36172)
Browse files Browse the repository at this point in the history
Sometimes this test could end up trying to create an index with a
negative or zero number of shards, which fails.  This fixes the test.
  • Loading branch information
gwbrown authored Dec 3, 2018
1 parent 234e70d commit 2658e34
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
public class ClusterDeprecationChecksTests extends ESTestCase {

public void testCheckShardLimit() {
int shardsPerNode = randomIntBetween(1, 10000);
int shardsPerNode = randomIntBetween(2, 10000);
int nodeCount = randomIntBetween(1, 10);
int maxShardsInCluster = shardsPerNode * nodeCount;
int currentOpenShards = maxShardsInCluster + randomIntBetween(0, 100);
Expand Down Expand Up @@ -59,7 +59,7 @@ public void testCheckShardLimit() {
MetaData goodMetaData = MetaData.builder(metaData).put(IndexMetaData.builder("test")
.settings(settings(Version.CURRENT))
.numberOfReplicas(0)
.numberOfShards(maxShardsInCluster - randomIntBetween(1, 100))).build();
.numberOfShards(maxShardsInCluster - randomIntBetween(1, (maxShardsInCluster - 1)))).build();
ClusterState goodState = ClusterState.builder(ClusterName.DEFAULT)
.metaData(goodMetaData).nodes(state.nodes()).build();
issues = DeprecationChecks.filterChecks(CLUSTER_SETTINGS_CHECKS, c -> c.apply(goodState));
Expand Down

0 comments on commit 2658e34

Please sign in to comment.