Skip to content
Merged
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 @@ -15,6 +15,7 @@
import com.fasterxml.jackson.databind.node.TextNode;
import org.elasticsearch.gradle.test.rest.transform.RestTestTransformGlobalSetup;
import org.elasticsearch.gradle.test.rest.transform.RestTestTransformGlobalTeardown;
import org.gradle.api.tasks.Internal;

import javax.annotation.Nullable;
import java.util.Iterator;
Expand Down Expand Up @@ -73,6 +74,7 @@ public ObjectNode transformTeardown(@Nullable ObjectNode teardownNodeParent) {
* features: allowed_warnings
* </pre>
*/
@Internal
public abstract String getSkipFeatureName();

private boolean hasFeature(ArrayNode skipParent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.elasticsearch.gradle.test.rest.transform.RestTestTransformByParentObject;
import org.elasticsearch.gradle.test.rest.transform.feature.FeatureInjector;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Internal;

import java.util.Map;

Expand Down Expand Up @@ -49,6 +50,7 @@ public void transformTest(ObjectNode doNodeParent) {
}

@Override
@Internal
public String getKeyToFind() {
return "do";
}
Expand Down
17 changes: 17 additions & 0 deletions modules/reindex/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ apply plugin: 'elasticsearch.test-with-dependencies'
apply plugin: 'elasticsearch.jdk-download'
apply plugin: 'elasticsearch.yaml-rest-test'
apply plugin: 'elasticsearch.java-rest-test'
apply plugin: 'elasticsearch.yaml-rest-compat-test'
apply plugin: 'elasticsearch.internal-cluster-test'

esplugin {
Expand Down Expand Up @@ -158,3 +159,19 @@ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
}
}
}

tasks.named("yamlRestCompatTest").configure {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a test to validate the change

./gradlew ':modules:reindex:yamlRestCompatTest' --tests "org.elasticsearch.index.reindex.ReindexClientYamlTestSuiteIT.test {yaml=reindex/30_search/Sorting and size combined}"  -Dtests.security.manager=true -Dtests.locale=fi -Dtests.timezone=Navajo -Druntime.java=15                 

systemProperty 'tests.rest.blacklist', [
'reindex/20_validation/reindex without source gives useful error message', /* type in exception message */
'reindex/85_scripting/Reindex all docs with one doc deletion', /*type in a request*/
'delete_by_query/10_basic/Limit by size',
'delete_by_query/10_basic/Response for version conflict \\(seq no powered\\)',
'delete_by_query/20_validation/both max_docs and size fails',
'delete_by_query/20_validation/invalid size fails',
'update_by_query/10_basic/Limit by size',
'update_by_query/10_basic/Response for version conflict \\(seq no powered\\)',
'update_by_query/20_validation/inconsistent max_docs and size fails',
'update_by_query/20_validation/invalid size fails',
'update_by_query/20_validation/update_by_query without source gives useful error message'
].join(',')
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.compatibility.RestApiCompatibleVersion;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.lucene.uid.Versions;
Expand Down Expand Up @@ -346,9 +347,16 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws

PARSER.declareField(sourceParser::parse, new ParseField("source"), ObjectParser.ValueType.OBJECT);
PARSER.declareField((p, v, c) -> destParser.parse(p, v.getDestination(), c), new ParseField("dest"), ObjectParser.ValueType.OBJECT);
PARSER.declareInt(ReindexRequest::setMaxDocsValidateIdentical, new ParseField("max_docs"));

PARSER.declareInt(ReindexRequest::setMaxDocsValidateIdentical,
new ParseField("max_docs", "size").withRestApiCompatibilityVersions(RestApiCompatibleVersion.V_7));

PARSER.declareInt(ReindexRequest::setMaxDocsValidateIdentical,
new ParseField("max_docs").withRestApiCompatibilityVersions(RestApiCompatibleVersion.V_8));
// avoid silently accepting an ignored size.
PARSER.declareInt((r,s) -> failOnSizeSpecified(), new ParseField("size"));
PARSER.declareInt((r,s) -> failOnSizeSpecified(),
new ParseField("size").withRestApiCompatibilityVersions(RestApiCompatibleVersion.V_8));

PARSER.declareField((p, v, c) -> v.setScript(Script.parse(p)), new ParseField("script"),
ObjectParser.ValueType.OBJECT);
PARSER.declareString(ReindexRequest::setConflicts, new ParseField("conflicts"));
Expand Down