Skip to content

Commit

Permalink
fix: configure southbound timeout with APIML_GATEWAY_TIMEOUT_MILLIS (#…
Browse files Browse the repository at this point in the history
…2154)

Signed-off-by: achmelo <a.chmelo@gmail.com>
  • Loading branch information
achmelo committed Mar 4, 2022
1 parent d95b05c commit 6af5d6f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
4 changes: 4 additions & 0 deletions gateway-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ apiml:
preferIpAddress: false
ignoredHeadersWhenCorsEnabled: Access-Control-Request-Method,Access-Control-Request-Headers,Access-Control-Allow-Origin,Access-Control-Allow-Methods,Access-Control-Allow-Headers,Access-Control-Allow-Credentials,Origin

httpclient:
conn-pool:
requestConnectionTimeout: ${apiml.gateway.timeoutMillis}

catalog:
serviceId: apicatalog
metrics:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
*/
package org.zowe.apiml.functional.gateway;

import io.restassured.RestAssured;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpStatus;
import org.apache.http.message.BasicNameValuePair;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
Expand All @@ -34,21 +36,27 @@ class GatewayTimeoutTest implements TestWithStartedInstances {
private static final int SECOND = 1000;
private static final int DEFAULT_TIMEOUT = 30 * SECOND;

@BeforeEach
void setUp() {
RestAssured.useRelaxedHTTPSValidation();
RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
}

@Nested
class GivenRequestTakesTooLong {
@Nested
class WhenCallingThroughGateway {
@Test
void returnGatewayTimeout() {
assertTimeout(Duration.ofMillis(DEFAULT_TIMEOUT + (5 * SECOND)), () -> {
assertTimeout(Duration.ofMillis(DEFAULT_TIMEOUT * 6 + (2 * SECOND)), () -> {
given()
.when()
.when()
.get(getUriFromGateway(API_V1_GREETING_URI,
Collections.singletonList(
new BasicNameValuePair("delayMs", String.valueOf(DEFAULT_TIMEOUT + SECOND)))
Collections.singletonList(
new BasicNameValuePair("delayMs", String.valueOf(DEFAULT_TIMEOUT + SECOND)))
)
)
.then()
.then()
.statusCode(HttpStatus.SC_GATEWAY_TIMEOUT);
});
}
Expand Down

0 comments on commit 6af5d6f

Please sign in to comment.