Tests: Add shortcut "all" to skip version ranges in rest tests

This was suggested on #10656 as cleaner than " - " to indicate all
versions should be skipped.

closes #10702
This commit is contained in:
Ryan Ernst 2015-04-21 10:03:36 -07:00
parent a4f98e7400
commit 2d54738339
5 changed files with 23 additions and 3 deletions

View File

@ -1,7 +1,7 @@
--- ---
setup: setup:
- skip: - skip:
version: " - " version: "all"
reason: leaves transient metadata behind, need to fix it reason: leaves transient metadata behind, need to fix it
--- ---
"Test put settings": "Test put settings":

View File

@ -81,7 +81,7 @@ setup:
--- ---
"put settings in list of indices": "put settings in list of indices":
- skip: - skip:
version: " - " version: "all"
reason: list of indices not implemented yet reason: list of indices not implemented yet
- do: - do:
indices.put_settings: indices.put_settings:

View File

@ -2,7 +2,7 @@
"Metadata Fields": "Metadata Fields":
- skip: - skip:
version: " - " version: "all"
reason: "Update doesn't return metadata fields, waiting for #3259" reason: "Update doesn't return metadata fields, waiting for #3259"
- do: - do:

View File

@ -97,6 +97,9 @@ public class SkipSection {
if (versionRange == null) { if (versionRange == null) {
return new Version[] { null, null }; return new Version[] { null, null };
} }
if (versionRange.trim().equals("all")) {
return new Version[]{VersionUtils.getFirstVersion(), Version.CURRENT};
}
String[] skipVersions = versionRange.split("-"); String[] skipVersions = versionRange.split("-");
if (skipVersions.length > 2) { if (skipVersions.length > 2) {
throw new IllegalArgumentException("version range malformed: " + versionRange); throw new IllegalArgumentException("version range malformed: " + versionRange);

View File

@ -49,6 +49,23 @@ public class SkipSectionParserTests extends AbstractParserTests {
assertThat(skipSection.getReason(), equalTo("Delete ignores the parent param")); assertThat(skipSection.getReason(), equalTo("Delete ignores the parent param"));
} }
public void testParseSkipSectionAllVersions() throws Exception {
parser = YamlXContent.yamlXContent.createParser(
"version: \" all \"\n" +
"reason: Delete ignores the parent param"
);
SkipSectionParser skipSectionParser = new SkipSectionParser();
SkipSection skipSection = skipSectionParser.parse(new RestTestSuiteParseContext("api", "suite", parser));
assertThat(skipSection, notNullValue());
assertThat(skipSection.getLowerVersion(), equalTo(VersionUtils.getFirstVersion()));
assertThat(skipSection.getUpperVersion(), equalTo(Version.CURRENT));
assertThat(skipSection.getFeatures().size(), equalTo(0));
assertThat(skipSection.getReason(), equalTo("Delete ignores the parent param"));
}
@Test @Test
public void testParseSkipSectionFeatureNoVersion() throws Exception { public void testParseSkipSectionFeatureNoVersion() throws Exception {
parser = YamlXContent.yamlXContent.createParser( parser = YamlXContent.yamlXContent.createParser(