Add bad_request to the rest-api-spec catch params (#26539)
This adds another request to the catch params. It also makes sure that the generic request param does not allow 400 either.
This commit is contained in:
parent
1ca0b5e9e4
commit
f385e0cf26
|
@ -602,7 +602,7 @@ invalid `size` parameter to the `_search` API:
|
|||
POST /twitter/_search?size=surprise_me
|
||||
----------------------------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[s/surprise_me/surprise_me&error_trace=false/ catch:request]
|
||||
// TEST[s/surprise_me/surprise_me&error_trace=false/ catch:bad_request]
|
||||
// Since the test system sends error_trace=true by default we have to override
|
||||
|
||||
The response looks like:
|
||||
|
@ -636,7 +636,7 @@ But if you set `error_trace=true`:
|
|||
POST /twitter/_search?size=surprise_me&error_trace=true
|
||||
----------------------------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[catch:request]
|
||||
// TEST[catch:bad_request]
|
||||
|
||||
The response looks like:
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ PUT my-index/my-type/my-id?pipeline=my_pipeline_id
|
|||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[catch:request]
|
||||
// TEST[catch:bad_request]
|
||||
|
||||
See <<ingest-apis,Ingest APIs>> for more information about creating, adding, and deleting pipelines.
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ PUT my_index2/my_type/1 <2>
|
|||
}
|
||||
------------------------------
|
||||
// CONSOLE
|
||||
// TEST[catch:request]
|
||||
// TEST[catch:bad_request]
|
||||
<1> Routing is required for `my_type` documents.
|
||||
<2> This index request throws a `routing_missing_exception`.
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ PUT my_index/my_type/2
|
|||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[catch:request]
|
||||
// TEST[catch:bad_request]
|
||||
<1> The `number_one` field will contain the integer `10`.
|
||||
<2> This document will be rejected because coercion is disabled.
|
||||
|
||||
|
@ -88,6 +88,6 @@ PUT my_index/my_type/2
|
|||
{ "number_two": "10" } <2>
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[catch:request]
|
||||
// TEST[catch:bad_request]
|
||||
<1> The `number_one` field overrides the index level setting to enable coercion.
|
||||
<2> This document will be rejected because the `number_two` field inherits the index-level coercion setting.
|
||||
|
|
|
@ -44,7 +44,7 @@ PUT my_index/my_type/2
|
|||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[catch:request]
|
||||
// TEST[catch:bad_request]
|
||||
<1> This document will have the `text` field indexed, but not the `number_one` field.
|
||||
<2> This document will be rejected because `number_two` does not allow malformed values.
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
version: " - 5.99.99"
|
||||
reason: normalizer support in 6.0.0
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
indices.analyze:
|
||||
body:
|
||||
text: ABc
|
||||
|
|
|
@ -142,7 +142,7 @@ teardown:
|
|||
---
|
||||
"Test invalid processor config":
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
ingest.put_pipeline:
|
||||
id: "my_pipeline"
|
||||
body: >
|
||||
|
|
|
@ -122,7 +122,7 @@ teardown:
|
|||
---
|
||||
"Test pipeline with empty on_failure in a processor":
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
ingest.put_pipeline:
|
||||
id: "my_pipeline"
|
||||
body: >
|
||||
|
@ -155,7 +155,7 @@ teardown:
|
|||
---
|
||||
"Test pipeline with empty on_failure in pipeline":
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
ingest.put_pipeline:
|
||||
id: "my_pipeline"
|
||||
body: >
|
||||
|
|
|
@ -79,7 +79,7 @@ teardown:
|
|||
---
|
||||
"Test simulate with provided invalid pipeline definition":
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
ingest.simulate:
|
||||
body: >
|
||||
{
|
||||
|
@ -183,7 +183,7 @@ teardown:
|
|||
---
|
||||
"Test simulate with no provided pipeline or pipeline_id":
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
ingest.simulate:
|
||||
body: >
|
||||
{
|
||||
|
@ -206,7 +206,7 @@ teardown:
|
|||
---
|
||||
"Test simulate with invalid processor config":
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
ingest.simulate:
|
||||
body: >
|
||||
{
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
count: 1
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
update:
|
||||
index: test_1
|
||||
type: test
|
||||
|
|
|
@ -302,7 +302,7 @@
|
|||
indices.refresh: {}
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
update_by_query:
|
||||
refresh: true
|
||||
index: twitter
|
||||
|
|
|
@ -163,6 +163,7 @@ be caught and tested. For instance:
|
|||
The argument to `catch` can be any of:
|
||||
|
||||
[horizontal]
|
||||
`bad_request`:: a 400 response from ES
|
||||
`unauthorized`:: a 401 response from ES
|
||||
`forbidden`:: a 403 response from ES
|
||||
`missing`:: a 404 response from ES
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
index: index1
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
cat.segments:
|
||||
index: index1
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ setup:
|
|||
---
|
||||
"count body without query element":
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
count:
|
||||
index: test
|
||||
body:
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
reason: validation logic only fixed from 5.1.2 onwards
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
create:
|
||||
index: test
|
||||
type: test
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
reason: validation logic only fixed from 5.1.2 onwards
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
create:
|
||||
index: test
|
||||
type: test
|
||||
|
@ -20,7 +20,7 @@
|
|||
- match: { error.reason: "Validation Failed: 1: create operations only support internal versioning. use index instead;" }
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
create:
|
||||
index: test
|
||||
type: test
|
||||
|
|
|
@ -31,7 +31,7 @@ setup:
|
|||
"Parent omitted":
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
exists:
|
||||
index: test_1
|
||||
type: test
|
||||
|
|
|
@ -56,7 +56,7 @@ setup:
|
|||
---
|
||||
"Explain body without query element":
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
explain:
|
||||
index: test_1
|
||||
type: test
|
||||
|
|
|
@ -34,7 +34,7 @@ setup:
|
|||
---
|
||||
"Parent omitted":
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
get:
|
||||
index: test_1
|
||||
type: test
|
||||
|
|
|
@ -32,7 +32,7 @@ setup:
|
|||
"Parent omitted":
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
get_source:
|
||||
index: test_1
|
||||
type: test
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
- match: { _source: { foo: bar }}
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
index:
|
||||
index: idx
|
||||
type: type
|
||||
|
|
|
@ -14,7 +14,7 @@ setup:
|
|||
version: " - 5.99.0"
|
||||
reason: delete index doesn't support aliases only from 6.0.0 on
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
indices.delete:
|
||||
index: alias
|
||||
- do:
|
||||
|
@ -42,7 +42,7 @@ setup:
|
|||
version: " - 5.99.0"
|
||||
reason: delete index doesn't support aliases only from 6.0.0 on
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
indices.delete:
|
||||
index: alias,index2
|
||||
- do:
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
index: test_index
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
search:
|
||||
index: test_index
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ setup:
|
|||
index: _all
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
search:
|
||||
index: test_index2
|
||||
|
||||
|
@ -59,7 +59,7 @@ setup:
|
|||
index: test_*
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
search:
|
||||
index: test_index2
|
||||
|
||||
|
@ -86,7 +86,7 @@ setup:
|
|||
index: '*'
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
search:
|
||||
index: test_index3
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
index: test_index
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
indices.put_alias:
|
||||
index: test_index
|
||||
name: test_*
|
||||
|
@ -55,7 +55,7 @@
|
|||
index: foo
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
indices.put_alias:
|
||||
index: test_index
|
||||
name: foo
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
- match: {test.settings: {index.number_of_shards: '1', index.number_of_replicas: '0'}}
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
indices.put_template:
|
||||
name: test
|
||||
create: true
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
index: index1
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
indices.segments:
|
||||
index: index1
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ setup:
|
|||
version: " - 5.0.99"
|
||||
reason: strict stats handling does not exist in 5.0
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
indices.stats:
|
||||
metric: [ fieldata ]
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
version: " - 5.0.99"
|
||||
reason: strict stats handling does not exist in 5.0
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
nodes.stats:
|
||||
metric: [ transprot ]
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ setup:
|
|||
"Aggregating wrong datatype test":
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
search:
|
||||
body:
|
||||
aggs:
|
||||
|
|
|
@ -166,7 +166,7 @@ setup:
|
|||
"Aggregating wrong datatype test":
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
search:
|
||||
body:
|
||||
aggs:
|
||||
|
|
|
@ -166,7 +166,7 @@ setup:
|
|||
"Aggregating wrong datatype test":
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
search:
|
||||
body:
|
||||
aggs:
|
||||
|
|
|
@ -166,7 +166,7 @@ setup:
|
|||
"Aggregating wrong datatype test":
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
search:
|
||||
body:
|
||||
aggs:
|
||||
|
|
|
@ -288,7 +288,7 @@ setup:
|
|||
percents: []
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
search:
|
||||
body:
|
||||
aggs:
|
||||
|
@ -298,7 +298,7 @@ setup:
|
|||
percents: null
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
search:
|
||||
body:
|
||||
aggs:
|
||||
|
@ -308,7 +308,7 @@ setup:
|
|||
percents: ["foo"]
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
search:
|
||||
body:
|
||||
aggs:
|
||||
|
|
|
@ -298,7 +298,7 @@ setup:
|
|||
number_of_significant_value_digits: 10
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
search:
|
||||
body:
|
||||
aggs:
|
||||
|
@ -320,7 +320,7 @@ setup:
|
|||
percents: []
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
search:
|
||||
body:
|
||||
aggs:
|
||||
|
@ -331,7 +331,7 @@ setup:
|
|||
percents: null
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
search:
|
||||
body:
|
||||
aggs:
|
||||
|
@ -342,7 +342,7 @@ setup:
|
|||
percents: ["foo"]
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
search:
|
||||
body:
|
||||
aggs:
|
||||
|
|
|
@ -69,7 +69,7 @@ setup:
|
|||
"Search body without query element":
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
search:
|
||||
body:
|
||||
match:
|
||||
|
|
|
@ -22,7 +22,7 @@ setup:
|
|||
"Test with _local preference placed in query body - should fail":
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
search:
|
||||
index: test
|
||||
type: test
|
||||
|
|
|
@ -19,7 +19,7 @@ setup:
|
|||
"Test search_type=query_and_fetch not supported from REST layer":
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
search:
|
||||
index: test
|
||||
type: test
|
||||
|
@ -33,7 +33,7 @@ setup:
|
|||
"Test search_type=dfs_query_and_fetch not supported from REST layer":
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
search:
|
||||
index: test
|
||||
type: test
|
||||
|
|
|
@ -65,7 +65,7 @@ setup:
|
|||
body: { foo: bar }
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
catch: bad_request
|
||||
update:
|
||||
index: test_1
|
||||
type: test
|
||||
|
|
|
@ -320,6 +320,7 @@ public class DoSection implements ExecutableSection {
|
|||
private static Map<String, Tuple<String, org.hamcrest.Matcher<Integer>>> catches = new HashMap<>();
|
||||
|
||||
static {
|
||||
catches.put("bad_request", tuple("400", equalTo(400)));
|
||||
catches.put("unauthorized", tuple("401", equalTo(401)));
|
||||
catches.put("forbidden", tuple("403", equalTo(403)));
|
||||
catches.put("missing", tuple("404", equalTo(404)));
|
||||
|
@ -327,6 +328,7 @@ public class DoSection implements ExecutableSection {
|
|||
catches.put("conflict", tuple("409", equalTo(409)));
|
||||
catches.put("unavailable", tuple("503", equalTo(503)));
|
||||
catches.put("request", tuple("4xx|5xx", allOf(greaterThanOrEqualTo(400),
|
||||
not(equalTo(400)),
|
||||
not(equalTo(401)),
|
||||
not(equalTo(403)),
|
||||
not(equalTo(404)),
|
||||
|
|
Loading…
Reference in New Issue