From 180c6dca2b2053d42d9f11d1b69070b0d66cd54d Mon Sep 17 00:00:00 2001 From: Sharang Gupta Date: Wed, 28 Oct 2026 17:20:02 +0000 Subject: [PATCH] TestLinearBackoffManager: Re-enable probeUpdatesRemainingAttemptsIndirectly The test lost its @Test annotation in #494, when the Thread.sleep() calls were replaced, and has not run since. As rewritten it also could not pass: the second probe was still inside the cool-down period started by the preceding backOff, so the pool size stayed at 6. Age the last backoff together with the last probe before the second probe. --- .../client5/http/impl/classic/TestLinearBackoffManager.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestLinearBackoffManager.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestLinearBackoffManager.java index 45f96ef436..cdf3fd7e4f 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestLinearBackoffManager.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestLinearBackoffManager.java @@ -154,7 +154,8 @@ void testSetPerHostConnectionCap() { } - public void probeUpdatesRemainingAttemptsIndirectly() { + @Test + void probeUpdatesRemainingAttemptsIndirectly() { // Set initial max per route connPerRoute.setMaxPerRoute(route, 4); @@ -173,9 +174,10 @@ public void probeUpdatesRemainingAttemptsIndirectly() { // Apply probe once impl.probe(route); - // Manipulate lastRouteProbes to simulate that enough time has passed for the cooldown period + // Manipulate lastRouteProbes and lastRouteBackoffs to simulate that the cooldown period has passed final Map lastRouteProbes = impl.getLastRouteProbes(); lastRouteProbes.put(route, Instant.now().minusMillis(DEFAULT_COOL_DOWN_MS * 2)); + lastRouteBackoffs.put(route, Instant.now().minusMillis(DEFAULT_COOL_DOWN_MS * 2)); // Apply probe once more impl.probe(route);