Skip to content

Commit

Permalink
Merge pull request wildfly#6189 from yersan/WFCORE-7003
Browse files Browse the repository at this point in the history
[WFCORE-7003][WFCORE-7007] In testsuite, do not allow Bootable JAR to start in adm…
  • Loading branch information
bstansberry authored Sep 26, 2024
2 parents ba3a2bc + 531a69e commit 3353eff
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 17 deletions.
4 changes: 2 additions & 2 deletions testsuite/elytron/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@
<execution>
<id>server-provisioning</id>
<goals>
<goal>provisioning</goal>
<goal>provision</goal>
</goals>
<phase>none</phase>
</execution>
Expand Down Expand Up @@ -391,7 +391,7 @@
<execution>
<id>server-provisioning</id>
<goals>
<goal>provisioning</goal>
<goal>provision</goal>
</goals>
<phase>none</phase>
</execution>
Expand Down
21 changes: 13 additions & 8 deletions testsuite/manualmode/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@
<execution>
<id>server-provisioning</id>
<goals>
<goal>provisioning</goal>
<goal>provision</goal>
</goals>
<phase>none</phase>
</execution>
Expand Down Expand Up @@ -504,7 +504,7 @@
<execution>
<id>server-provisioning</id>
<goals>
<goal>provisioning</goal>
<goal>provision</goal>
</goals>
<phase>none</phase>
</execution>
Expand Down Expand Up @@ -572,12 +572,14 @@
<excludes>
<!-- No domain mode support -->
<exclude>org.jboss.as.test.manualmode.management.cli.CLIEmbedHostControllerTestCase.java</exclude>
<!-- multiple server start, admin mode, ... -->
<exclude>org.jboss.as.test.manualmode.auditlog.*TestCase.java</exclude>
<exclude>org.jboss.as.test.manualmode.auditlog.*Test.java</exclude>
<exclude>org.jboss.as.test.manualmode.adminonly.auditlog.*TestCase.java</exclude>
<exclude>org.jboss.as.test.manualmode.cli.boot.ops.*TestCase.java</exclude>

<exclude>org.jboss.as.test.manualmode.auditlog.AuditLogBootingLogTestCase</exclude>
<exclude>org.jboss.as.test.manualmode.auditlog.AuditLogFieldsOfLogTestCase</exclude>
<exclude>org.jboss.as.test.manualmode.auditlog.AuditLogBootingSyslogTestCase</exclude>

<!-- suspend mode -->
<exclude>org.jboss.as.test.manualmode.suspend.*TestCase.java</exclude>

<!-- restart the server -->
<exclude>org.jboss.as.test.manualmode.deployment.DeploymentScannerRedeploymentTestCase</exclude>
<exclude>org.jboss.as.test.manualmode.deployment.DeploymentScannerUnitTestCase</exclude>
Expand All @@ -599,6 +601,7 @@

<exclude>org.jboss.as.test.manualmode.management.cli.ManagementOpTimeoutTestCase</exclude>
<exclude>org.jboss.as.test.manualmode.management.cli.ShutdownTestCase</exclude>

<!-- access to module to cleanup but don't exist after stop -->
<exclude>org.jboss.as.test.manualmode.management.cli.CustomVaultInCLITestCase</exclude>
<exclude>org.jboss.as.test.manualmode.management.cli.CommandTimeoutHandlerTestCase</exclude>
Expand All @@ -620,8 +623,10 @@
<exclude>org.jboss.as.test.manualmode.expressions.CredentialStoreExpressionsTestCase</exclude>

<!-- admin mode -->
<exclude>org.wildfly.core.test.standalone.mgmt.HTTPSManagementInterfaceTestCase</exclude>
<exclude>org.wildfly.core.test.standalone.mgmt.ManagementInterfaceResourcesTestCase</exclude>
<exclude>org.jboss.as.test.manualmode.adminonly.auditlog.*TestCase.java</exclude>
<exclude>org.jboss.as.test.manualmode.cli.boot.ops.CliBootOperationsTestCase.java</exclude>

<!-- start /stop, and install extension before start -->
<exclude>org.wildfly.core.test.standalone.mgmt.PreparedResponseTestCase</exclude>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private void makeOneLog() {
public void beforeTest() throws Exception {
Files.deleteIfExists(FILE);
// Start the server
container.startInAdminMode();
container.start();
final ModelControllerClient client = container.getClient().getControllerClient();

CompositeOperationBuilder compositeOp = CompositeOperationBuilder.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import org.jboss.as.controller.client.impl.AdditionalBootCliScriptInvoker;
import org.jboss.as.controller.operations.common.Util;
import org.jboss.as.test.integration.management.util.CLIWrapper;
import org.jboss.as.test.shared.AssumeTestGroupUtil;
import org.jboss.as.test.shared.TimeoutUtil;
import org.jboss.dmr.ModelNode;
import org.jboss.logging.Logger;
Expand Down Expand Up @@ -312,7 +313,7 @@ public void testSimpleYamlWithReload() throws Exception {

@Test
public void testSimpleYamlWithCliBootOps() throws Exception {
Assume.assumeTrue("Boot CLI script can be used on only in admin-only mode which is no valid for bootable jar.", System.getProperty("ts.bootable") == null);
AssumeTestGroupUtil.assumeNotBootableJar();
StringBuilder sb = new StringBuilder();
sb.append(" -D" + AdditionalBootCliScriptInvoker.MARKER_DIRECTORY_PROPERTY + "=").append(markerDirectory.toAbsolutePath());
sb.append(" -D" + AdditionalBootCliScriptInvoker.CLI_SCRIPT_PROPERTY + "=").append(cliScript.toAbsolutePath());
Expand All @@ -330,6 +331,7 @@ public void testSimpleYamlWithCliBootOps() throws Exception {

@Test
public void testYamlChangesAppliedInAdminOnlyModeWithoutBootCliScript() throws Exception {
AssumeTestGroupUtil.assumeNotBootableJar();
container.start(null, null, Server.StartMode.ADMIN_ONLY, System.out, false, null, null, null, null, new Path[]{testYaml});
Assert.assertEquals("Yaml changes to configuration were persisted to xml. This should never happen as it's in read-only mode.", expectedXml, readConfigAsXml());
}
Expand Down Expand Up @@ -535,6 +537,7 @@ public void testIdempotence() throws Exception {

@Test
public void testYamlChangesSurviveReload() throws Exception {
AssumeTestGroupUtil.assumeNotBootableJar();
container.startYamlExtension(new Path[]{testYaml});
Assert.assertEquals("Yaml changes to configuration were persisted to xml. This should never happen as it's in read-only mode.", expectedXml, readConfigAsXml());
// read model and verify that test.yml changes are there
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class HTTPSConnectionWithCLITestCase {
@BeforeClass
public static void prepareServer() throws Exception {

containerController.startInAdminMode();
containerController.start();

serverResourcesSetup.setup(containerController.getClient());

Expand Down
4 changes: 2 additions & 2 deletions testsuite/rbac/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@
<execution>
<id>server-provisioning</id>
<goals>
<goal>provisioning</goal>
<goal>provision</goal>
</goals>
<phase>none</phase>
</execution>
Expand Down Expand Up @@ -365,7 +365,7 @@
<execution>
<id>server-provisioning</id>
<goals>
<goal>provisioning</goal>
<goal>provision</goal>
</goals>
<phase>none</phase>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,13 @@ public Void run() {
private AssumeTestGroupUtil() {
// prevent instantiation
}

public static void assumeNotBootableJar() {
assumeCondition("Some tests cannot run in Bootable JAR packaging",
() -> !isBootableJar());
}

public static boolean isBootableJar() {
return System.getProperty("ts.bootable") != null;
}
}
4 changes: 2 additions & 2 deletions testsuite/standalone/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
<execution>
<id>server-provisioning</id>
<goals>
<goal>provisioning</goal>
<goal>provision</goal>
</goals>
<phase>none</phase>
</execution>
Expand Down Expand Up @@ -366,7 +366,7 @@
<execution>
<id>server-provisioning</id>
<goals>
<goal>provisioning</goal>
<goal>provision</goal>
</goals>
<phase>none</phase>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ protected void start(PrintStream out) {
CommandBuilder cbuilder = null;
boolean needNormalModeCheck = false;
if (isBootableJar) {
if (this.startMode != StartMode.NORMAL) {
throw new IllegalStateException("Bootable JAR only supports StartMode.NORMAL, however " + this.startMode + " was requested.");
}
final Path bootableJarPath = Paths.get(bootableJar);
if (Files.notExists(bootableJarPath) || Files.isDirectory(bootableJarPath)) {
throw new IllegalStateException("Cannot find: " + bootableJar);
Expand Down

0 comments on commit 3353eff

Please sign in to comment.