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 @@ -74,7 +74,7 @@ public static Iterable<Object[]> parameters() throws Exception {
entries.add(new NamedXContentRegistry.Entry(ExecutableSection.class,
new ParseField("compare_analyzers"), CompareAnalyzers::parse));
NamedXContentRegistry executableSectionRegistry = new NamedXContentRegistry(entries);
return ESClientYamlSuiteTestCase.createParameters(executableSectionRegistry);
return ESClientYamlSuiteTestCase.createParameters(executableSectionRegistry, TESTS_PATH);
}

@Override
Expand Down
2 changes: 2 additions & 0 deletions qa/rest-compat-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ integTest.dependsOn(copyRestTestsResources)
dependencies {
compile project(':test:framework')
}

test.enabled = false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note - this line will likely conflict with this line #53228

Copy link
Contributor

Choose a reason for hiding this comment

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

I have only disabled it temporarily to see if this will try to continue the build

Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* 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.
*/
package org.elasticsearch.rest.compat;

import com.carrotsearch.randomizedtesting.annotations.Name;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* 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.
*/
package org.elasticsearch.rest.compat;

import com.carrotsearch.randomizedtesting.annotations.Name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public abstract class ESClientYamlSuiteTestCase extends ESRestTestCase {
*/
private static final String REST_TESTS_VALIDATE_SPEC = "tests.rest.validate_spec";

private static final String TESTS_PATH = "/rest-api-spec/test";
protected static final String TESTS_PATH = "/rest-api-spec/test";
private static final String SPEC_PATH = "/rest-api-spec/api";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,37 @@

import org.elasticsearch.test.ESTestCase;

import static org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase.TESTS_PATH;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.Matchers.greaterThan;

public class ESClientYamlSuiteTestCaseTests extends ESTestCase {

public void testLoadAllYamlSuites() throws Exception {
Map<String,Set<Path>> yamlSuites = ESClientYamlSuiteTestCase.loadSuites("");
Map<String,Set<Path>> yamlSuites = ESClientYamlSuiteTestCase.loadSuites(TESTS_PATH, "");
assertEquals(2, yamlSuites.size());
}

public void testLoadSingleYamlSuite() throws Exception {
Map<String,Set<Path>> yamlSuites = ESClientYamlSuiteTestCase.loadSuites("suite1/10_basic");
Map<String,Set<Path>> yamlSuites = ESClientYamlSuiteTestCase.loadSuites(TESTS_PATH, "suite1/10_basic");
assertSingleFile(yamlSuites, "suite1", "10_basic.yml");

//extension .yaml is optional
yamlSuites = ESClientYamlSuiteTestCase.loadSuites("suite1/10_basic");
yamlSuites = ESClientYamlSuiteTestCase.loadSuites(TESTS_PATH, "suite1/10_basic");
assertSingleFile(yamlSuites, "suite1", "10_basic.yml");
}

public void testLoadMultipleYamlSuites() throws Exception {
//single directory
Map<String,Set<Path>> yamlSuites = ESClientYamlSuiteTestCase.loadSuites("suite1");
Map<String,Set<Path>> yamlSuites = ESClientYamlSuiteTestCase.loadSuites(TESTS_PATH, "suite1");
assertThat(yamlSuites, notNullValue());
assertThat(yamlSuites.size(), equalTo(1));
assertThat(yamlSuites.containsKey("suite1"), equalTo(true));
assertThat(yamlSuites.get("suite1").size(), greaterThan(1));

//multiple directories
yamlSuites = ESClientYamlSuiteTestCase.loadSuites("suite1", "suite2");
yamlSuites = ESClientYamlSuiteTestCase.loadSuites(TESTS_PATH, "suite1", "suite2");
assertThat(yamlSuites, notNullValue());
assertThat(yamlSuites.size(), equalTo(2));
assertThat(yamlSuites.containsKey("suite1"), equalTo(true));
Expand All @@ -63,7 +64,7 @@ public void testLoadMultipleYamlSuites() throws Exception {
assertEquals(2, yamlSuites.get("suite2").size());

//multiple paths, which can be both directories or yaml test suites (with optional file extension)
yamlSuites = ESClientYamlSuiteTestCase.loadSuites("suite2/10_basic", "suite1");
yamlSuites = ESClientYamlSuiteTestCase.loadSuites(TESTS_PATH, "suite2/10_basic", "suite1");
assertThat(yamlSuites, notNullValue());
assertThat(yamlSuites.size(), equalTo(2));
assertThat(yamlSuites.containsKey("suite2"), equalTo(true));
Expand Down