From 54932f5cb666b5f5c18645c63cca7585312c0442 Mon Sep 17 00:00:00 2001 From: Marc Nuri Date: Mon, 16 Dec 2024 12:40:55 +0100 Subject: [PATCH] test: improve http client failure test performance (disable retry) Signed-off-by: Marc Nuri --- .../fabric8/kubernetes/client/http/AbstractHttpPostTest.java | 4 +++- .../fabric8/kubernetes/client/http/AbstractHttpPutTest.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/AbstractHttpPostTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/AbstractHttpPostTest.java index 50866bc85ce..0896f9cf502 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/AbstractHttpPostTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/AbstractHttpPostTest.java @@ -15,6 +15,7 @@ */ package io.fabric8.kubernetes.client.http; +import io.fabric8.kubernetes.client.RequestConfigBuilder; import io.fabric8.mockwebserver.DefaultMockServer; import io.fabric8.mockwebserver.http.RecordedRequest; import org.junit.jupiter.api.AfterAll; @@ -161,7 +162,8 @@ public void expectContinue() throws Exception { public void expectFailure() throws IOException, URISyntaxException { try (final ServerSocket serverSocket = new ServerSocket(0)) { - try (HttpClient client = getHttpClientFactory().newBuilder().build()) { + try (HttpClient client = getHttpClientFactory().newBuilder() + .tag(new RequestConfigBuilder().withRequestRetryBackoffLimit(0).build()).build()) { final URI uri = uriForPath(serverSocket, "/post-failing"); serverSocket.close(); diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/AbstractHttpPutTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/AbstractHttpPutTest.java index 9bcbae71877..d902786a519 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/AbstractHttpPutTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/AbstractHttpPutTest.java @@ -15,6 +15,7 @@ */ package io.fabric8.kubernetes.client.http; +import io.fabric8.kubernetes.client.RequestConfigBuilder; import io.fabric8.mockwebserver.DefaultMockServer; import io.fabric8.mockwebserver.http.RecordedRequest; import org.junit.jupiter.api.AfterAll; @@ -97,7 +98,8 @@ public void putInputStreamBody() throws Exception { public void expectFailure() throws IOException, URISyntaxException { try (final ServerSocket serverSocket = new ServerSocket(0)) { - try (HttpClient client = getHttpClientFactory().newBuilder().build()) { + try (HttpClient client = getHttpClientFactory().newBuilder() + .tag(new RequestConfigBuilder().withRequestRetryBackoffLimit(0).build()).build()) { final URI uri = uriForPath(serverSocket, "/put-failing"); serverSocket.close();