-
Notifications
You must be signed in to change notification settings - Fork 25k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REST test for typeless APIs. (#33934)
This commit duplicates REST tests for the - `indices.create` - `indices.put_mapping` - `indices.get_mapping` - `index` - `get` - `delete` - `update` - `bulk` APIs, so that we both test them when used without types (include_type_name=false) and with types, mostly for mixed-version cluster tests. Given a suite called `X_test_name.yml`, I first copied it to `(X+1)_test_name_with_types.yml` and then changed `X_test_name.yml` to set `include_type_name=false` on every API that supports it. Relates #15613
- Loading branch information
Showing
97 changed files
with
3,200 additions
and
771 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
rest-api-spec/src/main/resources/rest-api-spec/test/bulk/11_basic_with_types.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
"Array of objects": | ||
- do: | ||
bulk: | ||
refresh: true | ||
body: | ||
- index: | ||
_index: test_index | ||
_type: test_type | ||
_id: test_id | ||
- f1: v1 | ||
f2: 42 | ||
- index: | ||
_index: test_index | ||
_type: test_type | ||
_id: test_id2 | ||
- f1: v2 | ||
f2: 47 | ||
|
||
- do: | ||
count: | ||
index: test_index | ||
|
||
- match: {count: 2} | ||
|
||
--- | ||
"Empty _id": | ||
- do: | ||
bulk: | ||
refresh: true | ||
body: | ||
- index: | ||
_index: test | ||
_type: type | ||
_id: '' | ||
- f: 1 | ||
- index: | ||
_index: test | ||
_type: type | ||
_id: id | ||
- f: 2 | ||
- index: | ||
_index: test | ||
_type: type | ||
- f: 3 | ||
- match: { errors: true } | ||
- match: { items.0.index.status: 400 } | ||
- match: { items.0.index.error.type: illegal_argument_exception } | ||
- match: { items.0.index.error.reason: if _id is specified it must not be empty } | ||
- match: { items.1.index.result: created } | ||
- match: { items.2.index.result: created } | ||
|
||
- do: | ||
count: | ||
index: test | ||
|
||
- match: { count: 2 } | ||
|
||
--- | ||
"empty action": | ||
|
||
- do: | ||
catch: /Malformed action\/metadata line \[3\], expected FIELD_NAME but found \[END_OBJECT\]/ | ||
headers: | ||
Content-Type: application/json | ||
bulk: | ||
body: | | ||
{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id"}} | ||
{"f1": "v1", "f2": 42} | ||
{} |
10 changes: 8 additions & 2 deletions
10
rest-api-spec/src/main/resources/rest-api-spec/test/bulk/20_list_of_strings.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
rest-api-spec/src/main/resources/rest-api-spec/test/bulk/21_list_of_strings_with_types.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
"List of strings": | ||
- do: | ||
bulk: | ||
refresh: true | ||
body: | ||
- '{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id"}}' | ||
- '{"f1": "v1", "f2": 42}' | ||
- '{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id2"}}' | ||
- '{"f1": "v2", "f2": 47}' | ||
|
||
- do: | ||
count: | ||
index: test_index | ||
|
||
- match: {count: 2} | ||
|
10 changes: 8 additions & 2 deletions
10
rest-api-spec/src/main/resources/rest-api-spec/test/bulk/30_big_string.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
rest-api-spec/src/main/resources/rest-api-spec/test/bulk/31_big_string_with_types.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
"One big string": | ||
- do: | ||
bulk: | ||
refresh: true | ||
body: | | ||
{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id"}} | ||
{"f1": "v1", "f2": 42} | ||
{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id2"}} | ||
{"f1": "v2", "f2": 47} | ||
- do: | ||
count: | ||
index: test_index | ||
|
||
- match: {count: 2} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
rest-api-spec/src/main/resources/rest-api-spec/test/bulk/41_source_with_types.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
"Source filtering": | ||
- do: | ||
index: | ||
refresh: true | ||
index: test_index | ||
type: test_type | ||
id: test_id_1 | ||
body: { "foo": "bar", "bar": "foo" } | ||
|
||
- do: | ||
index: | ||
refresh: true | ||
index: test_index | ||
type: test_type | ||
id: test_id_2 | ||
body: { "foo": "qux", "bar": "pux" } | ||
|
||
- do: | ||
index: | ||
refresh: true | ||
index: test_index | ||
type: test_type | ||
id: test_id_3 | ||
body: { "foo": "corge", "bar": "forge" } | ||
|
||
|
||
- do: | ||
bulk: | ||
refresh: true | ||
body: | | ||
{ "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_1", "_source": true } } | ||
{ "doc": { "foo": "baz" } } | ||
{ "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_2" } } | ||
{ "_source": true, "doc": { "foo": "quux" } } | ||
- match: { items.0.update.get._source.foo: baz } | ||
- match: { items.1.update.get._source.foo: quux } | ||
|
||
- do: | ||
bulk: | ||
index: test_index | ||
type: test_type | ||
_source: true | ||
body: | | ||
{ "update": { "_id": "test_id_3" } } | ||
{ "doc": { "foo": "garply" } } | ||
- match: { items.0.update.get._source.foo: garply } | ||
|
||
- do: | ||
bulk: | ||
refresh: true | ||
body: | | ||
{ "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_1", "_source": {"includes": "bar"} } } | ||
{ "doc": { "foo": "baz" } } | ||
{ "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_2" } } | ||
{ "_source": {"includes": "foo"}, "doc": { "foo": "quux" } } | ||
- match: { items.0.update.get._source.bar: foo } | ||
- is_false: items.0.update.get._source.foo | ||
- match: { items.1.update.get._source.foo: quux } | ||
- is_false: items.1.update.get._source.bar | ||
|
||
- do: | ||
bulk: | ||
index: test_index | ||
type: test_type | ||
_source_include: foo | ||
body: | | ||
{ "update": { "_id": "test_id_3" } } | ||
{ "doc": { "foo": "garply" } } | ||
- match: { items.0.update.get._source.foo: garply } | ||
- is_false: items.0.update.get._source.bar | ||
|
Oops, something went wrong.