From 9ba897fbd6930296680679ac0f2c354d75c839c9 Mon Sep 17 00:00:00 2001 From: David Turner Date: Mon, 18 May 2020 15:15:56 +0100 Subject: [PATCH] Random iterations in testDataOnlyNodePersistence (#56906) PR #56893 was supposed to randomise the iteration count in `testDataOnlyNodePersistence` but this change was mistakenly omitted. This commit addresses this. --- .../gateway/GatewayMetaStatePersistedStateTests.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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);