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 98dd209f127cd..a351371844956 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,7 @@ 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 { - maxWaitTime = 5; + if ((unit.equals(TimeUnit.SECONDS) && maxWaitTime > 5) || unit.equals(TimeUnit.MINUTES)) maxWaitTime = 5; 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);