@@ -687,6 +687,7 @@ func TestAppenderFlushRequestError(t *testing.T) {
687687 _ , _ , stat := docappendertest .DecodeBulkRequestWithStats (r )
688688 bytesUncompressedTotal += stat .UncompressedBytes
689689 w .WriteHeader (sc )
690+ w .Write ([]byte (`{"error": {"root_cause": [{"type": "x_content_parse_exception","reason": "reason"}],"type": "x_content_parse_exception","reason": "reason","caused_by": {"type": "json_parse_exception","reason": "reason"}},"status": 400}` ))
690691 })
691692 indexer , err := docappender .New (client , docappender.Config {FlushInterval : time .Minute })
692693 require .NoError (t , err )
@@ -722,22 +723,22 @@ func TestAppenderFlushRequestError(t *testing.T) {
722723 assert .Equal (t , wantStats , stats )
723724 }
724725 t .Run ("400" , func (t * testing.T ) {
725- test (t , http .StatusBadRequest , "flush failed (400): [400 Bad Request] " )
726+ test (t , http .StatusBadRequest , "flush failed (400): { \" error \" :{ \" type \" : \" x_content_parse_exception \" , \" caused_by \" :{ \" type \" : \" json_parse_exception \" }}} " )
726727 })
727728 t .Run ("403" , func (t * testing.T ) {
728- test (t , http .StatusForbidden , "flush failed (403): [403 Forbidden] " )
729+ test (t , http .StatusForbidden , "flush failed (403): { \" error \" :{ \" type \" : \" x_content_parse_exception \" , \" caused_by \" :{ \" type \" : \" json_parse_exception \" }}} " )
729730 })
730731 t .Run ("429" , func (t * testing.T ) {
731- test (t , http .StatusTooManyRequests , "flush failed (429): [429 Too Many Requests] " )
732+ test (t , http .StatusTooManyRequests , "flush failed (429): { \" error \" :{ \" type \" : \" x_content_parse_exception \" , \" caused_by \" :{ \" type \" : \" json_parse_exception \" }}} " )
732733 })
733734 t .Run ("500" , func (t * testing.T ) {
734- test (t , http .StatusInternalServerError , "flush failed (500): [500 Internal Server Error] " )
735+ test (t , http .StatusInternalServerError , "flush failed (500): { \" error \" :{ \" type \" : \" x_content_parse_exception \" , \" caused_by \" :{ \" type \" : \" json_parse_exception \" }}} " )
735736 })
736737 t .Run ("503" , func (t * testing.T ) {
737- test (t , http .StatusServiceUnavailable , "flush failed (503): [503 Service Unavailable] " )
738+ test (t , http .StatusServiceUnavailable , "flush failed (503): { \" error \" :{ \" type \" : \" x_content_parse_exception \" , \" caused_by \" :{ \" type \" : \" json_parse_exception \" }}} " )
738739 })
739740 t .Run ("504" , func (t * testing.T ) {
740- test (t , http .StatusGatewayTimeout , "flush failed (504): [504 Gateway Timeout] " )
741+ test (t , http .StatusGatewayTimeout , "flush failed (504): { \" error \" :{ \" type \" : \" x_content_parse_exception \" , \" caused_by \" :{ \" type \" : \" json_parse_exception \" }}} " )
741742 })
742743}
743744
0 commit comments