Skip to content

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

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 1 commit into from
Apr 22, 2015
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
2 changes: 1 addition & 1 deletion rest-api-spec/test/cluster.put_settings/10_basic.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
setup:
- skip:
version: " - "
version: "all"
reason: leaves transient metadata behind, need to fix it
---
"Test put settings":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ setup:
---
"put settings in list of indices":
- skip:
version: " - "
version: "all"
reason: list of indices not implemented yet
- do:
indices.put_settings:
Expand Down
2 changes: 1 addition & 1 deletion rest-api-spec/test/update/85_fields_meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Metadata Fields":

- skip:
version: " - "
version: "all"
reason: "Update doesn't return metadata fields, waiting for #3259"

- do:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ private Version[] parseVersionRange(String versionRange) {
if (versionRange == null) {
return new Version[] { null, null };
}
if (versionRange.trim().equals("all")) {
return new Version[]{VersionUtils.getFirstVersion(), Version.CURRENT};
}
String[] skipVersions = versionRange.split("-");
if (skipVersions.length > 2) {
throw new IllegalArgumentException("version range malformed: " + versionRange);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,23 @@ public void testParseSkipSectionVersionNoFeature() throws Exception {
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
public void testParseSkipSectionFeatureNoVersion() throws Exception {
parser = YamlXContent.yamlXContent.createParser(
Expand Down