Skip to content

Commit

Permalink
make default test parameters unique
Browse files Browse the repository at this point in the history
  • Loading branch information
laDok8 committed Apr 28, 2023
1 parent bbb31f7 commit 546f138
Show file tree
Hide file tree
Showing 24 changed files with 105 additions and 57 deletions.
14 changes: 14 additions & 0 deletions aws-wildfly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,25 @@

<name>${project.artifactId}</name>

<properties>
<!-- to guarantee test instance Name uniqueness, supports: https://github.com/wildfly-extras/sunstone/issues/154 -->
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
<test.instance.name>eapSunstoneInjectInstance-${timestamp}</test.instance.name>
<azure.group>sunstoneDeployGroup-${timestamp}</azure.group>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<mvn.pom.test.instance.name>${test.instance.name}</mvn.pom.test.instance.name>
<azure.group>${azure.group}</azure.group>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class AwsTestConstants {
public static final String TAG = "sunstoneKeyTag";
public static final String NAME_1 = "sunstoneKeyName1";
public static final String NAME_2 = "sunstoneKeyName2";
public static final String instanceName = "${non.existing:eapSunstoneInjectInstance}";
public static final String instanceName = "${mvn.pom.test.instance.name:eapSunstoneInjectInstance}";
// must be same as in MP Config
public static final String region = "${ec2.region:us-east-1}";
public static final String mgmtUser = "${non.existing:admin}";
Expand Down
14 changes: 14 additions & 0 deletions aws/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,25 @@

<name>${project.artifactId}</name>

<properties>
<!-- to guarantee test instance Name uniqueness, supports: https://github.com/wildfly-extras/sunstone/issues/154 -->
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
<test.instance.name>eapSunstoneInjectInstance-${timestamp}</test.instance.name>
<azure.group>sunstoneDeployGroup-${timestamp}</azure.group>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<mvn.pom.test.instance.name>${test.instance.name}</mvn.pom.test.instance.name>
<azure.group>${azure.group}</azure.group>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
2 changes: 1 addition & 1 deletion aws/src/test/java/aws/cloudformation/AwsTestConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class AwsTestConstants {
public static final String TAG = "sunstoneKeyTag";
public static final String NAME_1 = "sunstoneKeyName1";
public static final String NAME_2 = "sunstoneKeyName2";
public static final String instanceName = "${non.existing:eapSunstoneInjectInstance}";
public static final String instanceName = "${mvn.pom.test.instance.name:eapSunstoneInjectInstance}";
// must be same as in MP Config
public static final String region = "${ec2.region:us-east-1}";
public static final String mgmtUser = "${non.existing:admin}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ public void resourceCreated() {
assertThat(hostname.get()).isNotBlank();
assertThat(hostnameWithRegion.get()).isNotBlank();
}
}
}
2 changes: 1 addition & 1 deletion aws/src/test/resources/sunstone.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sunstone.aws.accessKeyID=${aws.accessKeyID}
sunstone.aws.secretAccessKey=${aws.secretAccessKey}
sunstone.aws.region=${aws.region:us-east-1}
sunstone.aws.region=${aws.region:us-east-1}
14 changes: 14 additions & 0 deletions azure-wildfly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,25 @@

<name>${project.artifactId}</name>

<properties>
<!-- to guarantee test instance Name uniqueness, supports: https://github.com/wildfly-extras/sunstone/issues/154 -->
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
<test.instance.name>eapSunstoneInjectInstance-${timestamp}</test.instance.name>
<azure.group>sunstoneDeployGroup-${timestamp}</azure.group>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<mvn.pom.test.instance.name>${test.instance.name}</mvn.pom.test.instance.name>
<azure.group>${azure.group}</azure.group>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ public class AzureTestConstants {
public static final String VNET_NAME_2 = "sunstoneVnet2";

public static final String IMAGE_REF = "${image.ref:/subscriptions/7dee6f21-9f05-414e-99fa-08d3215fb420/resourceGroups/istraka-test/providers/Microsoft.Compute/images/eap-test-image}";
public static final String instanceName = "${non.existing:eapSunstoneInjectInstance}";
public static final String instanceName = "${mvn.pom.test.instance.name:eapSunstoneInjectInstance}";

public static final String deployGroup = "${azure.group:sunstoneDeployGroup}";

public static final String mgmtUser = "${non.existing:admin}";
public static final String mgmtPassword = "${non.existing:pass.1234}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@
@Suite
@SelectClasses({AzureVmDeployFirstTest.class, AzureVmUndeployedSecondTest.class})
public class VmDeploySuiteTests {
public static final String vmDeployGroup = "deploytestVM";
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@

import java.io.IOException;

import static sunstone.azure.armTemplates.archiveDeploy.vm.VmDeploySuiteTests.vmDeployGroup;
import static sunstone.azure.armTemplates.AzureTestConstants.deployGroup;

@WithAzureArmTemplate(parameters = {
@Parameter(k = "virtualMachineName", v = AzureTestConstants.instanceName),
@Parameter(k = "imageRefId", v = AzureTestConstants.IMAGE_REF)
},
template = "sunstone/azure/armTemplates/eap.json", group = vmDeployGroup, perSuite = true)
template = "sunstone/azure/armTemplates/eap.json", group = deployGroup, perSuite = true)
public class AzureVmDeployFirstTest {

@Deployment(name = "testapp.war")
@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = vmDeployGroup)
@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = deployGroup)
static WebArchive deploy() {
return ShrinkWrap.create(WebArchive.class)
.addAsWebResource(new StringAsset("Hello World"), "index.jsp");
}

@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = vmDeployGroup)
@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = deployGroup)
Hostname hostname;

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


import sunstone.azure.armTemplates.AzureTestConstants;
import sunstone.azure.armTemplates.archiveDeploy.vm.VmDeploySuiteTests;
import sunstone.azure.annotation.AzureVirtualMachine;
import okhttp3.OkHttpClient;
import okhttp3.Request;
Expand All @@ -14,6 +13,7 @@
import sunstone.inject.Hostname;

import java.io.IOException;
import static sunstone.azure.armTemplates.AzureTestConstants.deployGroup;

/**
* The test is supposed to run after AzureWebAppDeployFirstTest and verifies undeploy operation
Expand All @@ -22,9 +22,9 @@
@Parameter(k = "virtualMachineName", v = AzureTestConstants.instanceName),
@Parameter(k = "imageRefId", v = AzureTestConstants.IMAGE_REF)
},
template = "sunstone/azure/armTemplates/eap.json", group = VmDeploySuiteTests.vmDeployGroup, perSuite = true)
template = "sunstone/azure/armTemplates/eap.json", group = deployGroup, perSuite = true)
public class AzureVmUndeployedSecondTest {
@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = VmDeploySuiteTests.vmDeployGroup)
@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = deployGroup)
Hostname hostname;

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@
@Suite
@SelectClasses({AzureDomainVmDeployFirstTest.class, AzureDomainVmUndeployedSecondTest.class})
public class VmDomainDeploySuiteTests {
public static final String vmDeployGroup = "deploytestVM";
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,24 @@
import sunstone.azure.annotation.AzureVirtualMachine;
import sunstone.azure.annotation.WithAzureArmTemplate;
import sunstone.azure.armTemplates.AzureTestConstants;
import static sunstone.azure.armTemplates.archiveDeploy.vm.VmDeploySuiteTests.vmDeployGroup;
import static sunstone.azure.armTemplates.AzureTestConstants.deployGroup;

@WithAzureArmTemplate(parameters = {
@Parameter(k = "virtualMachineName", v = AzureTestConstants.instanceName),
@Parameter(k = "imageRefId", v = AzureTestConstants.IMAGE_REF)
},
template = "sunstone/azure/armTemplates/eapDomain.json", group = vmDeployGroup, perSuite = true)
template = "sunstone/azure/armTemplates/eapDomain.json", group = deployGroup, perSuite = true)
public class AzureDomainVmDeployFirstTest {

@Deployment(name = "testapp.war")
@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = vmDeployGroup)
@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = deployGroup)
@WildFly(mode = OperatingMode.DOMAIN)
static WebArchive deploy() {
return ShrinkWrap.create(WebArchive.class)
.addAsWebResource(new StringAsset("Hello World"), "index.jsp");
}

@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = vmDeployGroup)
@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = deployGroup)
@WildFly(mode = OperatingMode.DOMAIN)
Hostname hostname;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
import org.junit.jupiter.api.Test;
import sunstone.annotation.OperatingMode;
import sunstone.annotation.Parameter;
import sunstone.annotation.WildFly;import sunstone.inject.Hostname;
import sunstone.annotation.WildFly;
import sunstone.inject.Hostname;
import sunstone.azure.annotation.AzureVirtualMachine;
import sunstone.azure.annotation.WithAzureArmTemplate;
import sunstone.azure.armTemplates.AzureTestConstants;
import sunstone.azure.armTemplates.archiveDeploy.vmDomain.VmDomainDeploySuiteTests;
import static sunstone.azure.armTemplates.AzureTestConstants.deployGroup;

/**
* The test is supposed to run after AzureWebAppDeployFirstTest and verifies undeploy operation
Expand All @@ -22,9 +23,9 @@
@Parameter(k = "virtualMachineName", v = AzureTestConstants.instanceName),
@Parameter(k = "imageRefId", v = AzureTestConstants.IMAGE_REF)
},
template = "sunstone/azure/armTemplates/eapDomain.json", group = VmDomainDeploySuiteTests.vmDeployGroup, perSuite = true)
template = "sunstone/azure/armTemplates/eapDomain.json", group = deployGroup, perSuite = true)
public class AzureDomainVmUndeployedSecondTest {
@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = VmDomainDeploySuiteTests.vmDeployGroup)
@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = deployGroup)
@WildFly(mode = OperatingMode.DOMAIN)
Hostname hostname;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@
@Suite
@SelectClasses({AzureWebAppDeployFirstTest.class, AzureWebAppUndeployedSecondTest.class})
public class WebAppDeploySuiteTests {
public static final String webAppDeployGroup = "deploytestWebApp";
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


import sunstone.azure.armTemplates.AzureTestConstants;
import sunstone.azure.armTemplates.archiveDeploy.webapp.WebAppDeploySuiteTests;
import sunstone.azure.annotation.AzureWebApplication;
import okhttp3.OkHttpClient;
import okhttp3.Request;
Expand All @@ -18,18 +17,19 @@
import sunstone.inject.Hostname;

import java.io.IOException;
import static sunstone.azure.armTemplates.AzureTestConstants.deployGroup;

@WithAzureArmTemplate(template = "sunstone/azure/armTemplates/eapWebApp.json",
parameters = {@Parameter(k = "appName", v = AzureTestConstants.instanceName)}, group = WebAppDeploySuiteTests.webAppDeployGroup, perSuite = true)
parameters = {@Parameter(k = "appName", v = AzureTestConstants.instanceName)}, group = deployGroup, perSuite = true)
public class AzureWebAppDeployFirstTest {
@Deployment
@AzureWebApplication(name = AzureTestConstants.instanceName, group = WebAppDeploySuiteTests.webAppDeployGroup)
@AzureWebApplication(name = AzureTestConstants.instanceName, group = deployGroup)
static WebArchive deploy() {
return ShrinkWrap.create(WebArchive.class)
.addAsWebResource(new StringAsset("Hello World"), "index.jsp");
}

@AzureWebApplication(name = AzureTestConstants.instanceName, group = WebAppDeploySuiteTests.webAppDeployGroup)
@AzureWebApplication(name = AzureTestConstants.instanceName, group = deployGroup)
Hostname hostname;

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


import sunstone.azure.armTemplates.AzureTestConstants;
import sunstone.azure.armTemplates.archiveDeploy.webapp.WebAppDeploySuiteTests;
import sunstone.azure.annotation.AzureWebApplication;
import okhttp3.OkHttpClient;
import okhttp3.Request;
Expand All @@ -14,15 +13,16 @@
import sunstone.inject.Hostname;

import java.io.IOException;
import static sunstone.azure.armTemplates.AzureTestConstants.deployGroup;

/**
* The test is supposed to run after AzureWebAppDeployFirstTest and verifies undeploy operation
*/
@WithAzureArmTemplate(template = "sunstone/azure/armTemplates/eapWebApp.json",
parameters = {@Parameter(k = "appName", v = AzureTestConstants.instanceName)}, group = WebAppDeploySuiteTests.webAppDeployGroup, perSuite = true)
parameters = {@Parameter(k = "appName", v = AzureTestConstants.instanceName)}, group = deployGroup, perSuite = true)
public class AzureWebAppUndeployedSecondTest {

@AzureWebApplication(name = AzureTestConstants.instanceName, group = WebAppDeploySuiteTests.webAppDeployGroup)
@AzureWebApplication(name = AzureTestConstants.instanceName, group = deployGroup)
Hostname hostname;

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,21 @@
@Parameter(k = "virtualMachineName", v = AzureTestConstants.instanceName),
@Parameter(k = "imageRefId", v = AzureTestConstants.IMAGE_REF)
},
template = "sunstone/azure/armTemplates/eapDomain.json", group = AzDomainManagementClientTests.group, perSuite = true)
template = "sunstone/azure/armTemplates/eapDomain.json", group = AzureTestConstants.deployGroup, perSuite = true)
public class AzDomainManagementClientTests {

public static final String group = "${azure.group:sunstone-testing-group}";

@AzureVirtualMachine(name = AzureTestConstants.instanceName)
@WildFly(mode = OperatingMode.DOMAIN)
static OnlineManagementClient staticMgmtClient;

@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = AzDomainManagementClientTests.group)
@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = AzureTestConstants.deployGroup)
@WildFly(mode = OperatingMode.DOMAIN, domain = @DomainMode(user = AzureTestConstants.mgmtUser, password = AzureTestConstants.mgmtPassword, port = AzureTestConstants.mgmtPort, host = AzureTestConstants.mgmtHost, profile = AzureTestConstants.mgmtProfile))
static OnlineManagementClient staticMgmtClientSpecified;

@AzureVirtualMachine(name = AzureTestConstants.instanceName)
@WildFly(mode = OperatingMode.DOMAIN)
OnlineManagementClient mgmtClient;

@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = AzDomainManagementClientTests.group)
@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = AzureTestConstants.deployGroup)
@WildFly(mode = OperatingMode.DOMAIN, domain = @DomainMode(user = AzureTestConstants.mgmtUser, password = AzureTestConstants.mgmtPassword, port = AzureTestConstants.mgmtPort, host = AzureTestConstants.mgmtHost, profile = AzureTestConstants.mgmtProfile))
OnlineManagementClient mgmtClientSpecified;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,19 @@
@Parameter(k = "virtualMachineName", v = AzureTestConstants.instanceName),
@Parameter(k = "imageRefId", v = AzureTestConstants.IMAGE_REF)
},
template = "sunstone/azure/armTemplates/eap.json", group = AzStandaloneManagementClientTests.group, perSuite = true)
template = "sunstone/azure/armTemplates/eap.json", group = AzureTestConstants.deployGroup, perSuite = true)
public class AzStandaloneManagementClientTests {
public static final String group = "${azure.group:sunstone-testing-group}";

@AzureVirtualMachine(name = AzureTestConstants.instanceName)
static OnlineManagementClient staticMgmtClient;

@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = AzStandaloneManagementClientTests.group)
@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = AzureTestConstants.deployGroup)
@WildFly(mode = OperatingMode.STANDALONE, standalone = @StandaloneMode(user = AzureTestConstants.mgmtUser, password = AzureTestConstants.mgmtPassword, port = AzureTestConstants.mgmtPort))
static OnlineManagementClient staticMgmtClientSpecified;

@AzureVirtualMachine(name = AzureTestConstants.instanceName)
OnlineManagementClient mgmtClient;

@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = AzStandaloneManagementClientTests.group)
@AzureVirtualMachine(name = AzureTestConstants.instanceName, group = AzureTestConstants.deployGroup)
@WildFly(mode = OperatingMode.STANDALONE, standalone = @StandaloneMode(user = AzureTestConstants.mgmtUser, password = AzureTestConstants.mgmtPassword, port = AzureTestConstants.mgmtPort))
OnlineManagementClient mgmtClientSpecified;

Expand Down
14 changes: 14 additions & 0 deletions azure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,25 @@

<name>${project.artifactId}</name>

<properties>
<!-- to guarantee test instance Name uniqueness, supports: https://github.com/wildfly-extras/sunstone/issues/154 -->
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
<test.instance.name>eapSunstoneInjectInstance-${timestamp}</test.instance.name>
<azure.group>sunstoneDeployGroup-${timestamp}</azure.group>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<mvn.pom.test.instance.name>${test.instance.name}</mvn.pom.test.instance.name>
<azure.group>${azure.group}</azure.group>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class AzureTestConstants {
public static final String VNET_NAME_2 = "sunstoneVnet2";

public static final String IMAGE_REF = "${image.ref:/subscriptions/7dee6f21-9f05-414e-99fa-08d3215fb420/resourceGroups/istraka-test/providers/Microsoft.Compute/images/eap-test-image}";
public static final String instanceName = "${non.existing:eapSunstoneInjectInstance}";
public static final String instanceName = "${mvn.pom.test.instance.name:eapSunstoneInjectInstance}";

public static final String mgmtUser = "${non.existing:admin}";
public static final String mgmtPassword = "${non.existing:pass.1234}";
Expand Down
Loading

0 comments on commit 546f138

Please sign in to comment.