Skip to content

Commit

Permalink
Merge pull request wildfly#18306 from bstansberry/WFLY-19864
Browse files Browse the repository at this point in the history
[WFLY-19864] Update HostExcludesTestCase configuration to work with WF34
  • Loading branch information
bstansberry authored Oct 21, 2024
2 parents eb9bf6f + 08d8f0c commit 4a20ef9
Showing 1 changed file with 32 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public class HostExcludesTestCase extends BuildConfigurationTestBase {
private final boolean isFullDistribution = AssumeTestGroupUtil.isFullDistribution();
private final boolean isPreviewGalleonPack = AssumeTestGroupUtil.isWildFlyPreview();

private static final String MAJOR = "34.";
private static final String MAJOR = "35.";

/**
* Maintains the list of expected extensions for each host-exclude name for previous releases.
Expand Down Expand Up @@ -203,7 +203,8 @@ private enum ExtensionConf {
"org.wildfly.extension.mvc-krazo"
), List.of(), true),
WILDFLY_33_0("WildFly33.0", WILDFLY_32_0, List.of(), List.of(), true),
CURRENT(MAJOR, WILDFLY_33_0, getCurrentAddedExtensions(), getCurrentRemovedExtensions(), true);
WILDFLY_34_0("WildFly34.0", WILDFLY_33_0, List.of(), List.of(), true),
CURRENT(MAJOR, WILDFLY_34_0, getCurrentAddedExtensions(), getCurrentRemovedExtensions(), true);

private static List<String> getCurrentAddedExtensions() {
// If an extension is added to this list, also check if it is supplied only by wildfly-galleon-pack. If so, add it also
Expand All @@ -229,6 +230,7 @@ private static List<String> getCurrentRemovedExtensions() {
}

private final String name;
private final ExtensionConf parent;
private final Set<String> extensions = new HashSet<>();
private final Set<String> removed = new HashSet<>();
private static final Map<String, ExtensionConf> MAP;
Expand Down Expand Up @@ -282,6 +284,7 @@ private static List<String> getCurrentRemovedExtensions() {
*/
ExtensionConf(String name, ExtensionConf parent, List<String> addedExtensions, List<String> removedExtensions, boolean supported) {
this.name = name;
this.parent = parent;
this.modified = (addedExtensions != null && !addedExtensions.isEmpty()) || (removedExtensions != null && !removedExtensions.isEmpty());
if (addedExtensions != null) {
this.extensions.addAll(addedExtensions);
Expand Down Expand Up @@ -446,9 +449,34 @@ public void testHostExcludes() throws IOException, MgmtOperationException {
for(ExtensionConf extensionConf : ExtensionConf.values()) {
if (extensionConf != ExtensionConf.CURRENT && extensionConf.isSupported() && !processedExclusionsIds.contains(extensionConf.getName())) {
Set<String> extensions = extensionConf.getExtensions(isFullDistribution, isPreviewGalleonPack);
extensions.removeAll(ExtensionConf.forName(MAJOR).getRemovedExtensions());
ExtensionConf major = ExtensionConf.forName(MAJOR);
extensions.removeAll(major.getRemovedExtensions());
if (!extensions.equals(availableExtensions)) {
fail(String.format("The %s exclusion id is not defined as host exclusion for the current release.", extensionConf.getName()));
boolean fail = !isPreviewGalleonPack;
if (!fail) {
// If a preview-only extension remains preview-only beyond its initial release, there may be
// no host-exclude for its initial release, if nothing else added later needed an exclude
// for that release. But it also won't be in 'extensions'. We don't want to track in which
// release it arrived, so for any version between current and the first one where we have
// a host-exclude, treat it as if it were present.
// This opens the possibility of this test missing that the developer added the extension
// to existing host-exclude entries but forgot to add a new host-exclude,
// but the alternative is complete tracking of when extensions come and go from WFP.
fail = true;
ExtensionConf conf = major;
while (conf != null && !processedExclusionsIds.contains(conf.getName())) {
if (conf == extensionConf) {
extensions.addAll(major.previewExtensions);
fail = !extensions.equals(availableExtensions);
break;
}
conf = conf.parent;
}
}
if (fail) {
fail(String.format("The %s exclusion id is not defined as host exclusion for the current release. Extension diff: %s",
extensionConf.getName(), diff.apply(availableExtensions, extensions)));
}
}
}
}
Expand Down

0 comments on commit 4a20ef9

Please sign in to comment.