Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ public void apply(Project project) {
// setup IDE
GradleUtils.setupIdeForTestSourceSet(project, yamlCompatTestSourceSet);

// wire this task into check
project.getTasks().named(JavaBasePlugin.CHECK_TASK_NAME).configure(check -> check.dependsOn(yamlRestCompatTestTask));
// do not wire this task into check ... this will likely go into it's own lifecycle outside of check
// project.getTasks().named(JavaBasePlugin.CHECK_TASK_NAME).configure(check -> check.dependsOn(yamlRestCompatTestTask));
}

// TODO: implement custom extension that allows us move around of the projects between major versions and still find them
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# Licensed to Elasticsearch under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

implementation-class=org.elasticsearch.gradle.test.rest.YamlRestCompatTestPlugin
11 changes: 11 additions & 0 deletions modules/ingest-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* under the License.
*/
apply plugin: 'elasticsearch.yaml-rest-test'
apply plugin: 'elasticsearch.yaml-rest-compat-test'
apply plugin: 'elasticsearch.internal-cluster-test'

esplugin {
Expand Down Expand Up @@ -57,3 +58,13 @@ tasks.named("thirdPartyAudit").configure {
'org.osgi.framework.wiring.BundleWiring'
)
}

tasks.named("yamlRestCompatTest").configure {
systemProperty 'tests.rest.blacklist', (
[
//tests use types
'ingest/200_dissect_processor/Test dissect processor mismatch',
'ingest/80_foreach/Test foreach Processor' // <-- manually overridden in yamlRestCompatTest
]
).join(",")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# copied from 7.x as-is but the compat header injected. This will not be necessary in the near future once the
# find/replace style of over ride is implemented and wired into the copy from the 7.x source. Compat header values will
# always be injected. Only specific assertions will need to be explict find/replaced and overriding an entire test
# like demonstrated here should not be needed in all but the rarest cases.
# Also note there is nothing special about the file/directory naming. just using <name>_compat as a convention.
# The different name also avoids any hard to troubleshoot which one is actually getting used questions.
# ./gradlew ':modules:ingest-common:yamlRestCompatTest' --tests "org.elasticsearch.ingest.common.IngestCommonClientYamlTestSuiteIT.test {yaml=ingest/80_foreach_compat/Test foreach Processor}" --info
---
setup:
- skip:
features: headers
---
teardown:
- do:
ingest.delete_pipeline:
id: "my_pipeline"
ignore: 404

---
"Test foreach Processor":
- do:
ingest.put_pipeline:
id: "my_pipeline"
body: >
{
"description": "_description",
"processors": [
{
"foreach" : {
"field" : "values",
"processor" : {
"uppercase" : {
"field" : "_ingest._value"
}
}
}
}
]
}
- match: { acknowledged: true }

- do:
headers:
Content-Type: "application/vnd.elasticsearch+json;compatible-with=7"
Accept: "application/vnd.elasticsearch+json;compatible-with=7"
index:
index: test
type: test
id: 1
pipeline: "my_pipeline"
body: >
{
"values": ["foo", "bar", "baz"]
}

- do:
get:
index: test
type: test
id: 1
- match: { _source.values: ["FOO", "BAR", "BAZ"] }

#exceeds the recurse max per thread and will runs some of these on a different thread
- do:
index:
index: test
id: 1
pipeline: "my_pipeline"
body: >
{
"values": ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u",
"v", "w", "x", "y", "z"]
}

- do:
get:
index: test
id: 1
- match: { _source.values: ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U",
"V", "W", "X", "Y", "Z"] }
11 changes: 11 additions & 0 deletions rest-api-spec/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apply plugin: 'elasticsearch.publish'
apply plugin: 'elasticsearch.rest-resources'
apply plugin: 'elasticsearch.validate-rest-spec'
apply plugin: 'elasticsearch.yaml-rest-test'
apply plugin: 'elasticsearch.yaml-rest-compat-test'

restResources {
restTests {
Expand All @@ -21,3 +22,13 @@ testClusters.all {

tasks.named("test").configure {enabled = false }
tasks.named("jarHell").configure {enabled = false }

tasks.named("yamlRestCompatTest").configure {
systemProperty 'tests.rest.blacklist', (
[
//tests use types
'ingest/200_dissect_processor/Test dissect processor mismatch',
'ingest/80_foreach/Test foreach rocessor' // <-- manually overridden in yamlRestCompatTest
]
).join(",")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
"Index with ID":

- skip:
version: " - 6.99.99"
reason: types are required in requests before 7.0.0

- do:
index:
index: test-weird-index-中文
id: 1
body: { foo: bar }

- match: { _index: test-weird-index-中文 }
- match: { _type: _doc }
- match: { _id: "1"}
- match: { _version: 1}

- do:
get:
index: test-weird-index-中文
id: 1

- match: { _index: test-weird-index-中文 }
- match: { _type: _doc }
- match: { _id: "1"}
- match: { _version: 1}
- match: { _source: { foo: bar }}

- do:
catch: bad_request
index:
index: idx
id: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
body: { foo: bar }
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
setup:
- skip:
features: headers

---
"Index with ID":

- do:
headers:
Content-Type: "application/vnd.elasticsearch+json;compatible-with=7"
Accept: "application/vnd.elasticsearch+json;compatible-with=7"
index:
index: test-weird-index-中文
type: weird.type
id: 1
body: { foo: bar }

- match: { _index: test-weird-index-中文 }
- match: { _type: _doc }
- match: { _id: "1"}
- match: { _version: 1}

- do:
headers:
Content-Type: "application/vnd.elasticsearch+json;compatible-with=7"
Accept: "application/vnd.elasticsearch+json;compatible-with=7"
get:
index: test-weird-index-中文
type: weird.type
id: 1

- match: { _index: test-weird-index-中文 }
- match: { _type: _doc }
- match: { _id: "1"}
- match: { _version: 1}
- match: { _source: { foo: bar }}

- do:
headers:
Content-Type: "application/vnd.elasticsearch+json;compatible-with=7"
Accept: "application/vnd.elasticsearch+json;compatible-with=7"
catch: bad_request
index:
index: idx
type: type
id: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
body: { foo: bar }
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
"Index result field":

- skip:
version: " - 6.99.99"
reason: types are required in requests before 7.0.0
- do:
index:
index: test_index
id: 1
body: { foo: bar }

- match: { result: created }

- do:
index:
index: test_index
id: 1
body: { foo: bar }
op_type: index

- match: { result: updated }
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
"Index result field":

- do:
index:
index: test_index
type: test
id: 1
body: { foo: bar }

- match: { result: created }

- do:
index:
index: test_index
type: test
id: 1
body: { foo: bar }
op_type: index

- match: { result: updated }
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
"Index without ID":

- skip:
version: " - 6.99.99"
reason: types are required in requests before 7.0.0

- do:
index:
index: test_1
body: { foo: bar }

- is_true: _id
- match: { _index: test_1 }
- match: { _type: _doc }
- match: { _version: 1 }
- set: { _id: id }

- do:
get:
index: test_1
id: '$id'

- match: { _index: test_1 }
- match: { _type: _doc }
- match: { _id: $id }
- match: { _version: 1 }
- match: { _source: { foo: bar }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
"Index without ID":

- do:
index:
index: test_1
type: test
body: { foo: bar }

- is_true: _id
- match: { _index: test_1 }
- match: { _type: test }
- match: { _version: 1 }
- set: { _id: id }

- do:
get:
index: test_1
type: test
id: '$id'

- match: { _index: test_1 }
- match: { _type: test }
- match: { _id: $id }
- match: { _version: 1 }
- match: { _source: { foo: bar }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
"Optype":

- skip:
version: " - 6.99.99"
reason: types are required in requests before 7.0.0

- do:
index:
index: test_1
id: 1
op_type: create
body: { foo: bar }

- do:
catch: conflict
index:
index: test_1
id: 1
op_type: create
body: { foo: bar }

- do:
index:
index: test_1
id: 1
op_type: index
body: { foo: bar }

- match: { _version: 2 }
Loading