From ca42a9569dac81dbd88af419c4dacec57c061bae Mon Sep 17 00:00:00 2001 From: Harsha Vamsi Kalluri Date: Thu, 5 Sep 2024 15:09:33 -0700 Subject: [PATCH] Choose lower time Signed-off-by: Harsha Vamsi Kalluri --- .../main/java/org/opensearch/test/OpenSearchTestCase.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/framework/src/main/java/org/opensearch/test/OpenSearchTestCase.java b/test/framework/src/main/java/org/opensearch/test/OpenSearchTestCase.java index a351371844956..123cbcc97320e 100644 --- a/test/framework/src/main/java/org/opensearch/test/OpenSearchTestCase.java +++ b/test/framework/src/main/java/org/opensearch/test/OpenSearchTestCase.java @@ -1113,7 +1113,11 @@ public static void assertBusy(CheckedRunnable codeBlock) throws Excep * Runs the code block for the provided interval, waiting for no assertions to trip. */ public static void assertBusy(CheckedRunnable codeBlock, long maxWaitTime, TimeUnit unit) throws Exception { - if ((unit.equals(TimeUnit.SECONDS) && maxWaitTime > 5) || unit.equals(TimeUnit.MINUTES)) maxWaitTime = 5; + if ((unit.equals(TimeUnit.SECONDS) && maxWaitTime > 5) || unit.equals(TimeUnit.MINUTES)) { + maxWaitTime = 10; + unit = TimeUnit.SECONDS; + } + ; long maxTimeInMillis = TimeUnit.MILLISECONDS.convert(maxWaitTime, unit); // In case you've forgotten your high-school studies, log10(x) / log10(y) == log y(x) long iterations = Math.max(Math.round(Math.log10(maxTimeInMillis) / Math.log10(2)), 1);