Skip to content

[TEST] Core tests with runtime fields minor fix #62009

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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 @@ -8,7 +8,6 @@

import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;

import org.elasticsearch.common.xcontent.XContentLocation;
import org.elasticsearch.index.mapper.BooleanFieldMapper;
import org.elasticsearch.index.mapper.DateFieldMapper;
Expand Down Expand Up @@ -58,7 +57,7 @@ public static Iterable<Object[]> parameters() throws Exception {
// The setup section contains an unsupported option
continue;
}
if (false == modifySection(candidate.getTestPath(), candidate.getTestSection().getExecutableSections())) {
if (false == modifySection(candidate.getTestSection().getExecutableSections())) {
// The test section contains an unsupported option
continue;
}
Expand All @@ -80,7 +79,7 @@ public static Iterable<Object[]> parameters() throws Exception {
* with scripts that load from source.
*/
private static ClientYamlTestSuite modifiedSuite(ClientYamlTestCandidate candidate) {
if (false == modifySection(candidate.getSuitePath() + "/setup", candidate.getSetupSection().getExecutableSections())) {
if (false == modifySection(candidate.getSetupSection().getExecutableSections())) {
return null;
}
List<ExecutableSection> setup = new ArrayList<>(candidate.getSetupSection().getExecutableSections().size() + 1);
Expand All @@ -99,7 +98,7 @@ private static ClientYamlTestSuite modifiedSuite(ClientYamlTestCandidate candida
* Replace field configuration in {@code indices.create} with scripts
* that load from the source.
*/
private static boolean modifySection(String sectionName, List<ExecutableSection> executables) {
private static boolean modifySection(List<ExecutableSection> executables) {
for (ExecutableSection section : executables) {
if (false == (section instanceof DoSection)) {
continue;
Expand Down Expand Up @@ -232,10 +231,6 @@ public void execute(ClientYamlTestExecutionContext executionContext) throws IOEx
Map.entry("runtime_type", type),
Map.entry("script", painlessToLoadFromSource("{name}", type))
);
Map<String, Object> body = Map.ofEntries(
Map.entry("match_mapping_type", type.equals("keyword") ? "string" : type),
Map.entry("mapping", mapping)
);
if (type.contentEquals("keyword")) {
/*
* For "string"-type dynamic mappings emulate our default
Expand All @@ -248,7 +243,6 @@ public void execute(ClientYamlTestExecutionContext executionContext) throws IOEx
} else {
dynamicTemplates.add(Map.of(type, Map.of("match_mapping_type", type, "mapping", mapping)));
}
dynamicTemplates.add(Map.of(type, body));
}
List<Map<String, Object>> bodies = List.of(
Map.ofEntries(
Expand Down