diff --git a/testsuite/integration-arquillian/HOW-TO-RUN.md b/testsuite/integration-arquillian/HOW-TO-RUN.md index 6b849ae56c..84365eff50 100644 --- a/testsuite/integration-arquillian/HOW-TO-RUN.md +++ b/testsuite/integration-arquillian/HOW-TO-RUN.md @@ -64,7 +64,7 @@ mvn -f testsuite/integration-arquillian/tests/other/adapters/karaf/fuse63/pom.xm clean install \ -Pauth-server-wildfly \ -Papp-server-fuse63 \ - -Dfuse63.version=6.3.0.redhat-198 + -Dfuse63.version=6.3.0.redhat-229 ```` ### EAP6 with Hawtio @@ -117,23 +117,24 @@ mvn -f testsuite/integration-arquillian/tests/other/adapters/jboss/eap6-fuse/pom ### DB migration test -This will: +This test will: - start Keycloak 1.9.8 - import realm and some data to MySQL DB - stop Keycloak 1.9.8 - - start latest KEycloak and update DB from 1.9.8 + - start latest KEycloak, which automatically updates DB from 1.9.8 - Do some test that data are correct + 1) Prepare MySQL DB and ensure that MySQL DB is empty. See [../../misc/DatabaseTesting.md](../../misc/DatabaseTesting.md) for some hints for locally prepare Docker MySQL image. -2) Run the test (Update according to your DB connection): +2) Run the test (Update according to your DB connection, versions etc): ```` export DB_HOST=localhost mvn -f testsuite/integration-arquillian/pom.xml \ clean install \ - -Pauth-server-wildfly,jpa,auth-server-migration \ + -Pauth-server-wildfly,jpa,clean-jpa,auth-server-migration \ -Dtest=MigrationTest \ -Dmigration.mode=auto \ -Dmigrated.auth.server.version=1.9.8.Final \ @@ -146,8 +147,7 @@ mvn -f testsuite/integration-arquillian/pom.xml \ ```` ### JSON export/import migration test -This will - - start latest Keycloak and import the file, which was previously exported from Keycloak 1.9.8.Final +This will start latest Keycloak and import the realm JSON file, which was previously exported from Keycloak 1.9.8.Final ```` mvn -f testsuite/integration-arquillian/pom.xml \ diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/DeploymentTargetModifier.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/DeploymentTargetModifier.java index 3a4d0b97fc..bd6e5a051f 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/DeploymentTargetModifier.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/DeploymentTargetModifier.java @@ -35,12 +35,17 @@ import static org.keycloak.testsuite.arquillian.AppServerTestEnricher.getAppServ */ public class DeploymentTargetModifier extends AnnotationDeploymentScenarioGenerator { + // Will be replaced in runtime by real auth-server-container + public static final String AUTH_SERVER_CURRENT = "auth-server-current"; + protected final Logger log = Logger.getLogger(this.getClass()); @Override public List generate(TestClass testClass) { List deployments = super.generate(testClass); + checkAuthServerTestDeployment(deployments, testClass); + String appServerQualifier = getAppServerQualifier( testClass.getJavaClass()); @@ -56,4 +61,17 @@ public class DeploymentTargetModifier extends AnnotationDeploymentScenarioGenera return deployments; } + private void checkAuthServerTestDeployment(List descriptions, TestClass testClass) { + for (DeploymentDescription deployment : descriptions) { + if (deployment.getTarget() != null) { + String containerQualifier = deployment.getTarget().getName(); + if (AUTH_SERVER_CURRENT.equals(containerQualifier)) { + String authServerQualifier = AuthServerTestEnricher.AUTH_SERVER_CONTAINER; + log.infof("Setting target container for deployment %s.%s: %s", testClass.getName(), deployment.getName(), authServerQualifier); + deployment.setTarget(new TargetDescription(authServerQualifier)); + } + } + } + } + } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/MigrationTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/MigrationTest.java index 2e52077fdb..0526ab227f 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/MigrationTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/MigrationTest.java @@ -23,6 +23,7 @@ import java.util.stream.Collectors; import javax.ws.rs.NotFoundException; import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.TargetsContainer; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Before; import org.junit.Test; @@ -52,6 +53,7 @@ import org.keycloak.representations.idm.authorization.PolicyRepresentation; import org.keycloak.storage.UserStorageProvider; import org.keycloak.testsuite.AbstractKeycloakTest; import org.keycloak.testsuite.Assert; +import org.keycloak.testsuite.arquillian.DeploymentTargetModifier; import org.keycloak.testsuite.arquillian.migration.Migration; import org.keycloak.testsuite.runonserver.RunHelpers; import org.keycloak.testsuite.runonserver.RunOnServerDeployment; @@ -78,6 +80,7 @@ public class MigrationTest extends AbstractKeycloakTest { private RealmResource masterRealm; @Deployment + @TargetsContainer(DeploymentTargetModifier.AUTH_SERVER_CURRENT) public static WebArchive deploy() { return RunOnServerDeployment.create(); }