Search in sources :

Example 1 with HttpRequest

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");
}
Also used : HttpRequest(com.hubspot.horizon.HttpRequest) Test(org.junit.Test)

Aggregations

HttpRequest (com.hubspot.horizon.HttpRequest)1 Test (org.junit.Test)1