diff --git a/server/src/test/java/org/elasticsearch/gateway/GatewayMetaStatePersistedStateTests.java b/server/src/test/java/org/elasticsearch/gateway/GatewayMetaStatePersistedStateTests.java index 22f555d00251b..63fdeddb8d7d3 100644 --- a/server/src/test/java/org/elasticsearch/gateway/GatewayMetaStatePersistedStateTests.java +++ b/server/src/test/java/org/elasticsearch/gateway/GatewayMetaStatePersistedStateTests.java @@ -395,7 +395,8 @@ public void testDataOnlyNodePersistence() throws Exception { // generate a series of updates and check if batching works final String indexName = randomAlphaOfLength(10); long currentTerm = state.term(); - for (int i = 0; i < 1000; i++) { + final int iterations = randomIntBetween(1, 1000); + for (int i = 0; i < iterations; i++) { if (rarely()) { // bump term currentTerm = currentTerm + (rarely() ? randomIntBetween(1, 5) : 0L);