From 51f15bf48757ff7fc4ec669470ed01f63f6725cb Mon Sep 17 00:00:00 2001 From: Athou Date: Mon, 19 Aug 2024 08:22:39 +0200 Subject: [PATCH] github actions is sometimes very slow, increase default timeouts for tests --- .../java/com/commafeed/backend/HttpGetterTest.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/commafeed-server/src/test/java/com/commafeed/backend/HttpGetterTest.java b/commafeed-server/src/test/java/com/commafeed/backend/HttpGetterTest.java index 5762d5a4..630bcc70 100644 --- a/commafeed-server/src/test/java/com/commafeed/backend/HttpGetterTest.java +++ b/commafeed-server/src/test/java/com/commafeed/backend/HttpGetterTest.java @@ -56,10 +56,10 @@ class HttpGetterTest { this.config = Mockito.mock(CommaFeedConfiguration.class, Mockito.RETURNS_DEEP_STUBS); Mockito.when(config.httpClient().userAgent()).thenReturn(Optional.of("http-getter-test")); - Mockito.when(config.httpClient().connectTimeout()).thenReturn(Duration.ofMillis(500)); + Mockito.when(config.httpClient().connectTimeout()).thenReturn(Duration.ofSeconds(30)); Mockito.when(config.httpClient().sslHandshakeTimeout()).thenReturn(Duration.ofSeconds(30)); - Mockito.when(config.httpClient().socketTimeout()).thenReturn(Duration.ofMillis(500)); - Mockito.when(config.httpClient().responseTimeout()).thenReturn(Duration.ofMillis(300)); + Mockito.when(config.httpClient().socketTimeout()).thenReturn(Duration.ofSeconds(30)); + Mockito.when(config.httpClient().responseTimeout()).thenReturn(Duration.ofSeconds(30)); Mockito.when(config.httpClient().connectionTimeToLive()).thenReturn(Duration.ofSeconds(30)); Mockito.when(config.httpClient().maxResponseSize()).thenReturn(new MemorySize(new BigInteger("10000"))); Mockito.when(config.feedRefresh().httpThreads()).thenReturn(3); @@ -121,6 +121,9 @@ class HttpGetterTest { @Test void dataTimeout() { + Mockito.when(config.httpClient().responseTimeout()).thenReturn(Duration.ofMillis(500)); + this.getter = new HttpGetter(config, Mockito.mock(CommaFeedVersion.class), Mockito.mock(MetricRegistry.class)); + this.mockServerClient.when(HttpRequest.request().withMethod("GET")) .respond(HttpResponse.response().withDelay(Delay.milliseconds(1000))); @@ -129,6 +132,8 @@ class HttpGetterTest { @Test void connectTimeout() { + Mockito.when(config.httpClient().connectTimeout()).thenReturn(Duration.ofMillis(500)); + this.getter = new HttpGetter(config, Mockito.mock(CommaFeedVersion.class), Mockito.mock(MetricRegistry.class)); // try to connect to a non-routable address // https://stackoverflow.com/a/904609 Assertions.assertThrows(ConnectTimeoutException.class, () -> getter.getBinary("http://10.255.255.1"));