Skip to content

Commit ac8c6a9

Browse files
committed
fixup! STF-322: Add tests for transport-failure retry
1 parent 9991ece commit ac8c6a9

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/test/java/com/maxmind/geoip2/WebServiceClientTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
import java.util.List;
5151
import org.hamcrest.CoreMatchers;
5252
import org.junit.jupiter.api.Test;
53+
import org.junit.jupiter.api.condition.DisabledOnOs;
54+
import org.junit.jupiter.api.condition.OS;
5355
import org.junit.jupiter.api.extension.RegisterExtension;
5456
import org.junit.jupiter.params.ParameterizedTest;
5557
import org.junit.jupiter.params.provider.ValueSource;
@@ -627,7 +629,17 @@ public void testNoRetryOn4xx() {
627629
wireMock.verify(1, getRequestedFor(urlEqualTo(url)));
628630
}
629631

632+
// Disabled on Windows: when WireMock immediately RSTs a fresh connection,
633+
// the Windows TCP stack can cause the JDK's h2c upgrade probe to fail
634+
// before negotiation completes, prompting the JDK to retry the request
635+
// as plain HTTP/1.1. The HTTP/1.1 path then triggers the JDK's own
636+
// idempotent-GET retry inside HttpClient.send(), producing two wire
637+
// requests where the test expects one. This is platform-specific JDK
638+
// behavior we cannot disable from application code; the equivalent
639+
// POST-based test in minfraud-api-java is unaffected because the JDK
640+
// does not internally retry non-idempotent requests.
630641
@Test
642+
@DisabledOnOs(OS.WINDOWS)
631643
public void testMaxRetriesZeroDisablesRetry() {
632644
String url = "/geoip/v2.1/insights/1.2.3.4";
633645
wireMock.stubFor(get(urlEqualTo(url))
@@ -646,7 +658,11 @@ public void testMaxRetriesZeroDisablesRetry() {
646658
wireMock.verify(1, getRequestedFor(urlEqualTo(url)));
647659
}
648660

661+
// Disabled on Windows for the same reason as testMaxRetriesZeroDisablesRetry:
662+
// the JDK's internal idempotent-GET retry can stack on top of our retry
663+
// loop on the HTTP/1.1 fallback path, multiplying wire counts.
649664
@Test
665+
@DisabledOnOs(OS.WINDOWS)
650666
public void testRetriesExhausted() {
651667
String url = "/geoip/v2.1/insights/1.2.3.4";
652668
wireMock.stubFor(get(urlEqualTo(url))

0 commit comments

Comments
 (0)