|
@@ -44,6 +44,16 @@ public class CohereResponseHandlerTests extends ESTestCase {
|
|
|
MatcherAssert.assertThat(((ElasticsearchStatusException) exception.getCause()).status(), is(RestStatus.BAD_REQUEST));
|
|
|
}
|
|
|
|
|
|
+ public void testCheckForFailureStatusCode_ThrowsFor500_WithShouldRetryTrue() {
|
|
|
+ var exception = expectThrows(RetryException.class, () -> callCheckForFailureStatusCode(500, "id"));
|
|
|
+ assertTrue(exception.shouldRetry());
|
|
|
+ MatcherAssert.assertThat(
|
|
|
+ exception.getCause().getMessage(),
|
|
|
+ containsString("Received a server error status code for request from inference entity id [id] status [500]")
|
|
|
+ );
|
|
|
+ MatcherAssert.assertThat(((ElasticsearchStatusException) exception.getCause()).status(), is(RestStatus.BAD_REQUEST));
|
|
|
+ }
|
|
|
+
|
|
|
public void testCheckForFailureStatusCode_ThrowsFor429() {
|
|
|
var exception = expectThrows(RetryException.class, () -> callCheckForFailureStatusCode(429, "id"));
|
|
|
assertTrue(exception.shouldRetry());
|