Permalink
Comparing changes
Open a pull request
- 3 commits
- 8 files changed
- 0 commit comments
- 1 contributor
Commits on Mar 23, 2019
…ifferent JVMs MisxedDomainTestSupport will trigger caller (i.e a TestSuite) being ignored if the version under test can't handle the JVMs on offer. Test jobs can be configured with different java home paths for different JVMs. If this is done MixedDomainTestSupport will try and use an appropriate one for the legacy host.
Commits on Apr 05, 2019
[WFLY-11896] Improve ability of mixed-domain testsuite to deal with different JVMs
Unified
Split
Showing
with
100 additions
and 25 deletions.
- +22 −2 testsuite/mixed-domain/pom.xml
- +0 −3 testsuite/mixed-domain/src/test/java/org/jboss/as/test/integration/domain/mixed/DomainAdjuster.java
- +0 −3 ...e/mixed-domain/src/test/java/org/jboss/as/test/integration/domain/mixed/LegacyConfigAdjuster.java
- +5 −2 ...e/mixed-domain/src/test/java/org/jboss/as/test/integration/domain/mixed/MixedDomainTestSuite.java
- +31 −0 ...mixed-domain/src/test/java/org/jboss/as/test/integration/domain/mixed/MixedDomainTestSupport.java
- +1 −7 .../mixed-domain/src/test/java/org/jboss/as/test/integration/domain/mixed/SimpleMixedDomainTest.java
- +40 −8 testsuite/mixed-domain/src/test/java/org/jboss/as/test/integration/domain/mixed/Version.java
- +1 −0 ...rc/test/java/org/jboss/as/test/integration/domain/mixed/eap640/ElytronOnlyMaster640TestSuite.java
| @@ -199,8 +199,28 @@ | ||
| <artifactId>maven-surefire-plugin</artifactId> | ||
| <configuration> | ||
| <systemPropertyVariables> | ||
| <jboss.test.host.slave.jvmhome>${java8.home}</jboss.test.host.slave.jvmhome> | ||
| <jboss.test.host.slave.controller.jvmhome>${java8.home}</jboss.test.host.slave.controller.jvmhome> | ||
| <jboss.test.legacy.host.java8.home>${java8.home}</jboss.test.legacy.host.java8.home> | ||
| </systemPropertyVariables> | ||
| </configuration> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </profile> | ||
| <profile> | ||
| <id>legacy-slave-java11-home</id> | ||
| <activation> | ||
| <jdk>[12,)</jdk> | ||
| <property> | ||
| <name>java11.home</name> | ||
| </property> | ||
| </activation> | ||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <artifactId>maven-surefire-plugin</artifactId> | ||
| <configuration> | ||
| <systemPropertyVariables> | ||
| <jboss.test.legacy.host.java11.home>${java11.home}</jboss.test.legacy.host.java11.home> | ||
| </systemPropertyVariables> | ||
| </configuration> | ||
| </plugin> | ||
| @@ -87,9 +87,6 @@ static void adjustForVersion(final DomainClient client, final Version.AsVersion | ||
|
|
||
| final DomainAdjuster adjuster; | ||
| switch (asVersion) { | ||
| case EAP_6_2_0: | ||
| case EAP_6_3_0: | ||
| throw new UnsupportedOperationException(); | ||
| case EAP_6_4_0: | ||
| adjuster = new DomainAdjuster640(); | ||
| break; | ||
| @@ -47,9 +47,6 @@ static void adjustForVersion(final DomainClient client, final Version.AsVersion | ||
|
|
||
| final LegacyConfigAdjuster adjuster; | ||
| switch (asVersion) { | ||
| case EAP_6_2_0: | ||
| case EAP_6_3_0: | ||
| throw new UnsupportedOperationException(); | ||
| case EAP_6_4_0: | ||
| adjuster = new LegacyConfigAdjuster640(); | ||
| break; | ||
| @@ -68,7 +68,7 @@ protected static MixedDomainTestSupport getSupport(Class<?> testClass) { | ||
| return getSupport(testClass, Profile.FULL_HA, false); | ||
| } | ||
|
|
||
| protected static MixedDomainTestSupport getSupport(Class<?> testClass, boolean withMasterServers) { | ||
| protected static MixedDomainTestSupport getSupport(Class<?> testClass, boolean withMasterServers) { | ||
| return getSupport(testClass, Profile.FULL_HA, withMasterServers); | ||
| } | ||
|
|
||
| @@ -79,6 +79,7 @@ protected static MixedDomainTestSupport getSupport(Class<?> testClass, Profile p | ||
| } | ||
| return support; | ||
| } | ||
|
|
||
| /** | ||
| * Call this from a @BeforeClass method | ||
| * | ||
| @@ -91,6 +92,7 @@ protected static MixedDomainTestSupport getSupport(Class<?> testClass, String ma | ||
| protected static MixedDomainTestSupport getSupport(Class<?> testClass, String masterConfig, boolean adjustDomain, boolean legacyConfig, boolean withMasterServers) { | ||
| return getSupport(testClass, masterConfig, null, Profile.FULL_HA, adjustDomain, legacyConfig, withMasterServers); | ||
| } | ||
|
|
||
| /** | ||
| * Call this from a @BeforeClass method | ||
| * | ||
| @@ -147,7 +149,8 @@ static MixedDomainTestSupport getSupport(Class<?> testClass, String domainConfig | ||
| testSupport = MixedDomainTestSupport.create(testClass.getSimpleName(), version); | ||
| } | ||
| } catch (Exception e) { | ||
| throw new RuntimeException(e); | ||
| MixedDomainTestSuite.version = null; | ||
| throw (e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e)); | ||
| } | ||
| try { | ||
| //Start the the domain with adjustments to domain.xml | ||
| @@ -43,6 +43,7 @@ | ||
| import org.jboss.as.test.shared.TimeoutUtil; | ||
| import org.jboss.dmr.ModelNode; | ||
| import org.junit.Assert; | ||
| import org.junit.Assume; | ||
|
|
||
|
|
||
| /** | ||
| @@ -52,6 +53,12 @@ | ||
|
|
||
| public static final String STANDARD_DOMAIN_CONFIG = "copied-master-config/domain.xml"; | ||
| private static final String JBOSS_DOMAIN_SERVER_ARGS = "jboss.domain.server.args"; | ||
| private static final int TEST_VM_VERSION; | ||
|
|
||
| static { | ||
| String spec = System.getProperty("java.specification.version"); | ||
| TEST_VM_VERSION = "1.8".equals(spec) ? 8 : Integer.parseInt(spec); | ||
| } | ||
|
|
||
| private final Version.AsVersion version; | ||
| private final boolean adjustDomain; | ||
| @@ -69,6 +76,7 @@ private MixedDomainTestSupport(Version.AsVersion version, String testClass, Stri | ||
| this.legacyConfig = legacyConfig; | ||
| this.withMasterServers = withMasterServers; | ||
| this.profile = profile; | ||
| configureSlaveJavaHome(); | ||
| } | ||
|
|
||
| private static WildFlyManagedConfiguration configWithDisabledAsserts(String jbossHome){ | ||
| @@ -158,6 +166,29 @@ private void startSlaveServer() { | ||
| Assert.fail("Slave server-one did not start within " + timeout + " ms"); | ||
| } | ||
|
|
||
| private void configureSlaveJavaHome() { | ||
| // Look for properties pointing to a java home to use for the legacy host. | ||
| // Look for homes for the max JVM version the host can handle, working back to the min it can handle. | ||
| // We could start with the oldest and work forward, but that would likely result in all versions testing | ||
| // against the oldest VM. Starting with the newest will increase coverage by increasing the probability | ||
| // of different VM versions being used across the overall set of legacy host versions. | ||
| String javaHome = null; | ||
| for (int i = Math.min(version.getMaxVMVersion(), TEST_VM_VERSION - 1); i >= version.getMinVMVersion() && javaHome == null; i--) { | ||
| javaHome = System.getProperty("jboss.test.legacy.host.java" + i + ".home"); | ||
| } | ||
|
|
||
| if (javaHome != null) { | ||
| WildFlyManagedConfiguration cfg = getDomainSlaveConfiguration(); | ||
| cfg.setJavaHome(javaHome); | ||
| cfg.setControllerJavaHome(javaHome); | ||
| System.out.println("Set legacy host controller to use " + javaHome + " as JAVA_HOME"); | ||
| } else { | ||
| // Ignore the test if the slave cannot run using the current VM version | ||
| Assume.assumeTrue(TEST_VM_VERSION <= version.getMaxVMVersion()); | ||
| Assume.assumeTrue(TEST_VM_VERSION >= version.getMinVMVersion()); | ||
| } | ||
| } | ||
|
|
||
| private void startAndAdjust() { | ||
|
|
||
| String jbossDomainServerArgsValue = null; | ||
| @@ -116,9 +116,7 @@ public void test00001_ServerRunning() throws Exception { | ||
|
|
||
| @Test | ||
| public void test00002_Versioning() throws Exception { | ||
| if (version == Version.AsVersion.EAP_6_2_0 | ||
| || version == Version.AsVersion.EAP_7_0_0) { | ||
| //6.2.0 (https://issues.jboss.org/browse/WFLY-3228) and | ||
| if (version == Version.AsVersion.EAP_7_0_0) { | ||
| //7.0.0 (https://issues.jboss.org/browse/WFCORE-401) | ||
| // have the slave report back its own version, rather than the one from the DC, | ||
| //which is what should happen | ||
| @@ -226,10 +224,6 @@ public void test00010_JgroupsTransformers() throws Exception { | ||
| */ | ||
| @Test | ||
| public void test00011_ExampleDSConnection() throws Exception{ | ||
| if (version == Version.AsVersion.EAP_6_2_0) { | ||
| // see: https://issues.jboss.org/browse/WFLY-7792 | ||
| return; | ||
| } | ||
| PathAddress exampleDSAddress = PathAddress.pathAddress(PathElement.pathElement(HOST, "slave"), | ||
| PathElement.pathElement(RUNNING_SERVER, "server-one"), PathElement.pathElement(SUBSYSTEM, "datasources"), | ||
| PathElement.pathElement("data-source", "ExampleDS")); | ||
| @@ -21,6 +21,8 @@ | ||
| */ | ||
| package org.jboss.as.test.integration.domain.mixed; | ||
|
|
||
| import org.junit.Assume; | ||
|
|
||
| import java.lang.annotation.ElementType; | ||
| import java.lang.annotation.Retention; | ||
| import java.lang.annotation.RetentionPolicy; | ||
| @@ -41,12 +43,10 @@ | ||
| String EAP = "jboss-eap-"; | ||
|
|
||
| enum AsVersion { | ||
| EAP_6_2_0(EAP, 6, 2, 0), | ||
| EAP_6_3_0(EAP, 6, 3, 0), | ||
| EAP_6_4_0(EAP, 6, 4, 0), | ||
| EAP_7_0_0(EAP, 7, 0, 0), | ||
| EAP_7_1_0(EAP, 7, 1, 0), | ||
| EAP_7_2_0(EAP, 7, 2, 0), | ||
| EAP_6_4_0(EAP, 6, 4, 0, 8, 8), | ||
| EAP_7_0_0(EAP, 7, 0, 0, 8, 8), | ||
| EAP_7_1_0(EAP, 7, 1, 0, 8, 8), | ||
| EAP_7_2_0(EAP, 7, 2, 0, 11, 8), | ||
| ; | ||
|
|
||
|
|
||
| @@ -55,14 +55,18 @@ | ||
| private final int major; | ||
| private final int minor; | ||
| private final int micro; | ||
| private final int maxVM; | ||
| private final int minVM; | ||
| final String version; | ||
|
|
||
| AsVersion(String basename, int major, int minor, int micro){ | ||
| AsVersion(String basename, int major, int minor, int micro, int maxVM, int minVM){ | ||
| this.basename = basename; | ||
| this.major = major; | ||
| this.minor = minor; | ||
| this.micro = micro; | ||
| this.version = major + "." + minor + "." + micro; | ||
| this.maxVM = maxVM; | ||
| this.minVM = minVM; | ||
| } | ||
|
|
||
| public String getBaseName() { | ||
| @@ -86,7 +90,7 @@ public String getZipFileName() { | ||
| } | ||
|
|
||
| public boolean isEAP6Version() { | ||
| return (this == EAP_6_2_0 || this == EAP_6_3_0 || this == EAP_6_4_0); | ||
| return (this == EAP_6_4_0); | ||
| } | ||
|
|
||
| public int getMajor() { | ||
| @@ -101,6 +105,34 @@ public int getMicro() { | ||
| return micro; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the maximum Java version under which a legacy host can properly | ||
| * execute tests. | ||
| */ | ||
| public int getMaxVMVersion() { | ||
| return maxVM; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the minimum Java version under which a legacy host can properly | ||
| * execute tests. | ||
| */ | ||
| public int getMinVMVersion() { | ||
| return minVM; | ||
| } | ||
|
|
||
| /** | ||
| * Checks whether the current VM version exceeds the maximum version under which a legacy host can properly | ||
| * execute tests. The check is disabled if system property "jboss.test.host.slave.jvmhome" is set. | ||
| */ | ||
| public void assumeMaxVM() { | ||
| if (System.getProperty("jboss.test.host.slave.jvmhome") == null) { | ||
| String javaSpecVersion = System.getProperty("java.specification.version"); | ||
| int vm = "1.8".equals(javaSpecVersion) ? 8 : Integer.parseInt(javaSpecVersion); | ||
| Assume.assumeFalse(vm > maxVM); | ||
| } | ||
| } | ||
|
|
||
| int compare(int major, int minor) { | ||
| if (this.major < major) { | ||
| return -1; | ||
| @@ -36,6 +36,7 @@ | ||
|
|
||
| @BeforeClass | ||
| public static void initializeDomain() { | ||
| Version.AsVersion.EAP_6_4_0.assumeMaxVM(); | ||
| ElytronOnlyMasterTestSuite.getSupport(ElytronOnlyMaster640TestSuite.class); | ||
| } | ||
| } | ||