use of com.hubspot.horizon.HttpRequest in project Singularity by HubSpot.
the class SingularityClientTest method itRetriesRequestsThatErrorDueToDeadHost.
@Test
public void itRetriesRequestsThatErrorDueToDeadHost() {
when(httpClient.execute(any())).thenReturn(response);
when(response.getStatusCode()).thenReturn(503).thenReturn(200);
when(response.isServerError()).thenReturn(true).thenReturn(false);
singularityClient.pauseSingularityRequest("requestId", Optional.absent());
verify(httpClient, times(2)).execute(requestCaptor.capture());
HttpRequest sentRequest = requestCaptor.getValue();
assertThat(sentRequest.getUrl().toString()).matches("http://host(1|2)/singularity/v2/api/requests/request/requestId/pause");
}
Aggregations