Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.sap.cloud.sdk.cloudplatform.connectivity;

import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor;
import static com.github.tomakehurst.wiremock.client.WireMock.ok;
Expand Down Expand Up @@ -213,6 +214,21 @@ void testProxyConfigurationIsConsidered()
}
}

@Test
@SneakyThrows
void verifyDefaultRetryMechanism()
{
WIRE_MOCK_SERVER.stubFor(get(urlEqualTo("/too-many-requests")).willReturn(aResponse().withStatus(429)));
WIRE_MOCK_SERVER.stubFor(get(urlEqualTo("/temporary-error")).willReturn(aResponse().withStatus(503)));

final HttpClient client = sut.createHttpClient();
client.execute(new HttpGet(WIRE_MOCK_SERVER.url("/too-many-requests")), ignored -> ignored);
client.execute(new HttpGet(WIRE_MOCK_SERVER.url("/temporary-error")), ignored -> ignored);

WIRE_MOCK_SERVER.verify(2, getRequestedFor(urlEqualTo("/too-many-requests")));
WIRE_MOCK_SERVER.verify(2, getRequestedFor(urlEqualTo("/temporary-error")));
}

@SneakyThrows
private void assertCannotBeExecutedInParallel(
@Nonnull final ClassicHttpRequest firstRequest,
Expand Down