|
@@ -35,7 +35,7 @@ public class SkipSectionTests extends AbstractClientYamlTestFragmentParserTestCa
|
|
|
|
|
|
public void testSkipMultiRange() {
|
|
|
SkipSection section = new SkipSection("6.0.0 - 6.1.0, 7.1.0 - 7.5.0",
|
|
|
- Collections.emptyList() , "foobar");
|
|
|
+ Collections.emptyList(), Collections.emptyList(), "foobar");
|
|
|
|
|
|
assertFalse(section.skip(Version.CURRENT));
|
|
|
assertFalse(section.skip(Version.fromString("6.2.0")));
|
|
@@ -48,29 +48,37 @@ public class SkipSectionTests extends AbstractClientYamlTestFragmentParserTestCa
|
|
|
assertTrue(section.skip(Version.fromString("7.5.0")));
|
|
|
|
|
|
section = new SkipSection("- 7.1.0, 7.2.0 - 7.5.0, 8.0.0 -",
|
|
|
- Collections.emptyList() , "foobar");
|
|
|
+ Collections.emptyList(), Collections.emptyList(), "foobar");
|
|
|
assertTrue(section.skip(Version.fromString("7.0.0")));
|
|
|
assertTrue(section.skip(Version.fromString("7.3.0")));
|
|
|
assertTrue(section.skip(Version.fromString("8.0.0")));
|
|
|
}
|
|
|
|
|
|
public void testSkip() {
|
|
|
- SkipSection section = new SkipSection("6.0.0 - 6.1.0",
|
|
|
- randomBoolean() ? Collections.emptyList() : Collections.singletonList("warnings"), "foobar");
|
|
|
+ SkipSection section = new SkipSection(
|
|
|
+ "6.0.0 - 6.1.0",
|
|
|
+ randomBoolean() ? Collections.emptyList() : Collections.singletonList("warnings"),
|
|
|
+ Collections.emptyList(),
|
|
|
+ "foobar"
|
|
|
+ );
|
|
|
assertFalse(section.skip(Version.CURRENT));
|
|
|
assertTrue(section.skip(Version.fromString("6.0.0")));
|
|
|
- section = new SkipSection(randomBoolean() ? null : "6.0.0 - 6.1.0",
|
|
|
- Collections.singletonList("boom"), "foobar");
|
|
|
+ section = new SkipSection(
|
|
|
+ randomBoolean() ? null : "6.0.0 - 6.1.0",
|
|
|
+ Collections.singletonList("boom"),
|
|
|
+ Collections.emptyList(),
|
|
|
+ "foobar"
|
|
|
+ );
|
|
|
assertTrue(section.skip(Version.CURRENT));
|
|
|
}
|
|
|
|
|
|
public void testMessage() {
|
|
|
SkipSection section = new SkipSection("6.0.0 - 6.1.0",
|
|
|
- Collections.singletonList("warnings"), "foobar");
|
|
|
+ Collections.singletonList("warnings"), Collections.emptyList(), "foobar");
|
|
|
assertEquals("[FOOBAR] skipped, reason: [foobar] unsupported features [warnings]", section.getSkipMessage("FOOBAR"));
|
|
|
- section = new SkipSection(null, Collections.singletonList("warnings"), "foobar");
|
|
|
+ section = new SkipSection(null, Collections.singletonList("warnings"), Collections.emptyList(), "foobar");
|
|
|
assertEquals("[FOOBAR] skipped, reason: [foobar] unsupported features [warnings]", section.getSkipMessage("FOOBAR"));
|
|
|
- section = new SkipSection(null, Collections.singletonList("warnings"), null);
|
|
|
+ section = new SkipSection(null, Collections.singletonList("warnings"), Collections.emptyList(), null);
|
|
|
assertEquals("[FOOBAR] skipped, unsupported features [warnings]", section.getSkipMessage("FOOBAR"));
|
|
|
}
|
|
|
|
|
@@ -160,6 +168,49 @@ public class SkipSectionTests extends AbstractClientYamlTestFragmentParserTestCa
|
|
|
);
|
|
|
|
|
|
Exception e = expectThrows(ParsingException.class, () -> SkipSection.parse(parser));
|
|
|
- assertThat(e.getMessage(), is("version or features is mandatory within skip section"));
|
|
|
+ assertThat(e.getMessage(), is("version, features or os is mandatory within skip section"));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void testParseSkipSectionOsNoVersion() throws Exception {
|
|
|
+ parser = createParser(YamlXContent.yamlXContent,
|
|
|
+ "features: [\"skip_os\", \"some_feature\"]\n" +
|
|
|
+ "os: debian-9\n" +
|
|
|
+ "reason: memory accounting broken, see gh#xyz\n"
|
|
|
+ );
|
|
|
+
|
|
|
+ SkipSection skipSection = SkipSection.parse(parser);
|
|
|
+ assertThat(skipSection, notNullValue());
|
|
|
+ assertThat(skipSection.isVersionCheck(), equalTo(false));
|
|
|
+ assertThat(skipSection.getFeatures().size(), equalTo(2));
|
|
|
+ assertThat(skipSection.getOperatingSystems().size(), equalTo(1));
|
|
|
+ assertThat(skipSection.getOperatingSystems().get(0), equalTo("debian-9"));
|
|
|
+ assertThat(skipSection.getReason(), is("memory accounting broken, see gh#xyz"));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void testParseSkipSectionOsListNoVersion() throws Exception {
|
|
|
+ parser = createParser(YamlXContent.yamlXContent,
|
|
|
+ "features: skip_os\n" +
|
|
|
+ "os: [debian-9,windows-95,ms-dos]\n" +
|
|
|
+ "reason: see gh#xyz\n"
|
|
|
+ );
|
|
|
+
|
|
|
+ SkipSection skipSection = SkipSection.parse(parser);
|
|
|
+ assertThat(skipSection, notNullValue());
|
|
|
+ assertThat(skipSection.isVersionCheck(), equalTo(false));
|
|
|
+ assertThat(skipSection.getOperatingSystems().size(), equalTo(3));
|
|
|
+ assertThat(skipSection.getOperatingSystems().get(0), equalTo("debian-9"));
|
|
|
+ assertThat(skipSection.getOperatingSystems().get(1), equalTo("windows-95"));
|
|
|
+ assertThat(skipSection.getOperatingSystems().get(2), equalTo("ms-dos"));
|
|
|
+ assertThat(skipSection.getReason(), is("see gh#xyz"));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void testParseSkipSectionOsNoFeatureNoVersion() throws Exception {
|
|
|
+ parser = createParser(YamlXContent.yamlXContent,
|
|
|
+ "os: debian-9\n" +
|
|
|
+ "reason: memory accounting broken, see gh#xyz\n"
|
|
|
+ );
|
|
|
+
|
|
|
+ Exception e = expectThrows(ParsingException.class, () -> SkipSection.parse(parser));
|
|
|
+ assertThat(e.getMessage(), is("if os is specified, feature skip_os must be set"));
|
|
|
}
|
|
|
}
|