From ed3d003d657f48260664cc8c63ac747a437633fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Barto=C5=A1?= Date: Wed, 14 Sep 2022 05:29:53 -0400 Subject: [PATCH] Remove Legacy migration tests from testsuite (#14310) Closes #14300 --- .../integration-arquillian/HOW-TO-RUN.md | 42 +---- .../servers/migration/legacy/pom.xml | 154 ------------------ .../servers/migration/pom.xml | 51 +++--- .../servers/migration/quarkus/pom.xml | 62 ------- .../integration-arquillian/servers/pom.xml | 7 - .../arquillian/AuthServerTestEnricher.java | 4 +- .../testsuite/migration/MigrationTest.java | 111 +------------ .../base/src/test/resources/arquillian.xml | 19 --- .../integration-arquillian/tests/pom.xml | 84 ---------- 9 files changed, 39 insertions(+), 495 deletions(-) delete mode 100644 testsuite/integration-arquillian/servers/migration/legacy/pom.xml delete mode 100644 testsuite/integration-arquillian/servers/migration/quarkus/pom.xml diff --git a/testsuite/integration-arquillian/HOW-TO-RUN.md b/testsuite/integration-arquillian/HOW-TO-RUN.md index c4c1327558..312adacb69 100644 --- a/testsuite/integration-arquillian/HOW-TO-RUN.md +++ b/testsuite/integration-arquillian/HOW-TO-RUN.md @@ -171,39 +171,13 @@ mvn -f testsuite/integration-arquillian/pom.xml \ ### DB migration test This test will: - - start MySQL DB on docker container. Docker on your laptop is a requirement for this test. - - start Keycloak 4.8.3.Final (replace with the other version if needed) - - import realm and add some data to MySQL DB - - stop Keycloak 4.8.3.Final - - start latest Keycloak, which automatically updates DB from 4.8.3.Final - - Perform couple of tests to verify data after the update are correct - - Stop MySQL DB docker container. In case of a test failure, the MySQL container is not stopped, so you can manually inspect the database. - - -Run the test (Update according to your DB connection, versions etc): - - - export OLD_KEYCLOAK_VERSION=4.8.3.Final - - mvn -B -f testsuite/integration-arquillian/pom.xml \ - clean install \ - -Pjpa,auth-server-wildfly,db-mariadb,auth-server-migration-legacy \ - -Dauth.server.jboss.startup.timeout=900 \ - -Dtest=MigrationTest \ - -Dmigration.mode=auto \ - -Dmigrated.auth.server.version=$OLD_KEYCLOAK_VERSION \ - -Dprevious.product.unpacked.folder.name=keycloak-$OLD_KEYCLOAK_VERSION \ - -Dmigration.import.file.name=migration-realm-$OLD_KEYCLOAK_VERSION.json \ - -Dauth.server.ssl.required=false \ - -Djdbc.mvn.version=2.2.4 \ - -Dsurefire.failIfNoSpecifiedTests=false - - -For the available versions of old keycloak server, you can take a look to [this directory](tests/base/src/test/resources/migration-test) . - -### DB migration test with Quarkus -It is possible to execute DB migration tests for Keycloak with Quarkus distribution by specifying auth server as `-Pauth-server-quarkus` -and instead of the `auth-server-migration-legacy`, use only `auth-server-migration`. +- start MariaDB on docker container. Docker/Podman on your laptop is a requirement for this test. +- start Keycloak 17.0.0 (replace with the other version if needed) +- import realm and add some data to MariaDB +- stop Keycloak 17.0.0 +- start latest Keycloak, which automatically updates DB from 17.0.0 +- Perform a couple of tests to verify data after the update are correct +- Stop MariaDB docker container. In case of a test failure, the MariaDB container is not stopped, so you can manually inspect the database. The first version of Keycloak on Quarkus is version `17.0.0`. Therefore, it is not possible to define the older version. @@ -224,6 +198,8 @@ mvn -B -f testsuite/integration-arquillian/pom.xml \ -Dsurefire.failIfNoSpecifiedTests=false ``` +For the available versions of old keycloak server, you can take a look to [this directory](tests/base/src/test/resources/migration-test) . + ### DB migration test with manual mode Same test as above, but it uses manual migration mode. During startup of the new Keycloak server, Liquibase won't automatically perform DB update, but it diff --git a/testsuite/integration-arquillian/servers/migration/legacy/pom.xml b/testsuite/integration-arquillian/servers/migration/legacy/pom.xml deleted file mode 100644 index acf6368c0a..0000000000 --- a/testsuite/integration-arquillian/servers/migration/legacy/pom.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - org.keycloak.testsuite - integration-arquillian-migration-server-parent - 999-SNAPSHOT - - 4.0.0 - - integration-arquillian-migration-server-legacy - pom - Migration Server Legacy - - - ${basedir}/../../auth-server/jboss/common - scenario-standalone - keycloak-server-dist - auth-server-migration-legacy - - - - - - - maven-resources-plugin - - - copy-keystore - process-resources - - copy-resources - - - ${auth.server.home}/standalone/configuration - - - ${common.resources}/keystore - - keycloak.jks - keycloak.truststore - - - - - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - configure-server-jpa - generate-resources - - run - - - - - - - - ${jdbc.driver.tmp.dir} - ${jdbc.mvn.artifactId} - ${jdbc.mvn.version} - ${keycloak.connectionsJpa.url} - ${keycloak.connectionsJpa.user} - ${keycloak.connectionsJpa.password} - ${keycloak.connectionsJpa.schema} - - - - - - inject-truststore - generate-resources - - run - - - - - - - - - ant-apply-prepared-clis - process-resources - - run - - - - - - - - - - - move-driver-module - process-test-resources - - run - - - - - - - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - create-zip - package - - single - - - - ../assembly.xml - - false - - - - - - - diff --git a/testsuite/integration-arquillian/servers/migration/pom.xml b/testsuite/integration-arquillian/servers/migration/pom.xml index db0cbc4ac0..87cbe6b211 100644 --- a/testsuite/integration-arquillian/servers/migration/pom.xml +++ b/testsuite/integration-arquillian/servers/migration/pom.xml @@ -25,14 +25,15 @@ 4.0.0 - integration-arquillian-migration-server-parent - Migration Server Parent + integration-arquillian-migration-server pom + Migration Server Quarkus + + auth-server-migration ${project.build.directory}/unpacked/keycloak-${migrated.auth.server.version} - keycloak-quarkus-dist ${project.build.directory}/jdbc-driver @@ -101,7 +102,7 @@ org.keycloak - ${auth.server.dist.artifactId} + keycloak-quarkus-dist ${migrated.auth.server.version} zip ${project.build.directory}/unpacked @@ -130,30 +131,29 @@ + + org.apache.maven.plugins + maven-assembly-plugin + + + create-zip + package + + single + + + + assembly.xml + + false + + + + - - auth-server-migration-legacy - - legacy - - - keycloak-server-dist - - - - - auth-server-migration - - quarkus - - - keycloak-quarkus-dist - - - community @@ -182,7 +182,8 @@ - ${project.build.directory}/unpacked/${previous.product.unpacked.folder.name} + ${project.build.directory}/unpacked/${previous.product.unpacked.folder.name} + diff --git a/testsuite/integration-arquillian/servers/migration/quarkus/pom.xml b/testsuite/integration-arquillian/servers/migration/quarkus/pom.xml deleted file mode 100644 index 4563a40824..0000000000 --- a/testsuite/integration-arquillian/servers/migration/quarkus/pom.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - org.keycloak.testsuite - integration-arquillian-migration-server-parent - 999-SNAPSHOT - - 4.0.0 - - integration-arquillian-migration-server-quarkus - pom - - Migration Server Quarkus - - - keycloak-quarkus-dist - auth-server-migration - - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - create-zip - package - - single - - - - ../assembly.xml - - false - - - - - - - diff --git a/testsuite/integration-arquillian/servers/pom.xml b/testsuite/integration-arquillian/servers/pom.xml index d28c41a28d..1db1a7323e 100644 --- a/testsuite/integration-arquillian/servers/pom.xml +++ b/testsuite/integration-arquillian/servers/pom.xml @@ -66,13 +66,6 @@ - - auth-server-migration-legacy - - migration - - - win diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java index bd2bcbc3de..1782f0a084 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java @@ -330,7 +330,7 @@ public class AuthServerTestEnricher { // init migratedAuthServerInfo for (ContainerInfo container : suiteContext.getContainers()) { // migrated auth server - if (container.getQualifier().equals("auth-server-jboss-migration") || container.getQualifier().equals("auth-server-migration")) { + if (container.getQualifier().equals("auth-server-migration")) { updateWithAuthServerInfo(container); suiteContext.setMigratedAuthServerInfo(container); } @@ -338,7 +338,7 @@ public class AuthServerTestEnricher { // validate setup if (suiteContext.getMigratedAuthServerInfo() == null) { throw new RuntimeException("Migration test was enabled but no auth server from which to migrate was activated. " - + "A container matching 'auth-server-jboss-migration' or 'auth-server-migration' needs to be enabled in arquillian.xml."); + + "A container matching 'auth-server-migration' needs to be enabled in arquillian.xml."); } } 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 68f3a11a86..eeb5e44483 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 @@ -25,13 +25,13 @@ import org.keycloak.testsuite.arquillian.migration.Migration; import javax.ws.rs.NotFoundException; import java.util.List; -import org.keycloak.models.RealmModel; -import org.keycloak.services.managers.RealmManager; import org.keycloak.testsuite.arquillian.annotation.AuthServerContainerExclude.AuthServer; import static org.keycloak.testsuite.auth.page.AuthRealm.MASTER; /** + * Test for DB migration with legacy JPA store + * * @author Vlastislav Ramik */ public class MigrationTest extends AbstractMigrationTest { @@ -70,111 +70,4 @@ public class MigrationTest extends AbstractMigrationTest { testMigrationTo20_x(); } - - @Test - @Migration(versionPrefix = "9.") - @AuthServerContainerExclude(AuthServer.QUARKUS) - public void migration9_xTest() throws Exception { - testMigratedData(false); - testMigrationTo12_x(true); - testMigrationTo18_x(); - testMigrationTo19_x(); - testMigrationTo20_x(); - - // Always test offline-token login during migration test - testOfflineTokenLogin(); - testExtremelyLongClientAttribute(migrationRealm); - } - - @Test - @Migration(versionPrefix = "4.") - @AuthServerContainerExclude(AuthServer.QUARKUS) - public void migration4_xTest() throws Exception { - testMigratedData(); - testMigrationTo5_x(); - testMigrationTo6_x(); - testMigrationTo7_x(true); - testMigrationTo8_x(); - testMigrationTo9_x(); - testMigrationTo12_x(true); - testMigrationTo18_x(); - testMigrationTo19_x(); - testMigrationTo20_x(); - - // Always test offline-token login during migration test - testOfflineTokenLogin(); - testExtremelyLongClientAttribute(migrationRealm); - } - - @Test - @Migration(versionPrefix = "3.") - @AuthServerContainerExclude(AuthServer.QUARKUS) - public void migration3_xTest() throws Exception { - testMigratedData(); - testMigrationTo4_x(); - testMigrationTo5_x(); - testMigrationTo6_x(); - testMigrationTo7_x(true); - testMigrationTo8_x(); - testMigrationTo9_x(); - testMigrationTo12_x(true); - testMigrationTo18_x(); - testMigrationTo19_x(); - testMigrationTo20_x(); - - // Always test offline-token login during migration test - testOfflineTokenLogin(); - } - - @Test - @Migration(versionPrefix = "2.") - @AuthServerContainerExclude(AuthServer.QUARKUS) - public void migration2_xTest() throws Exception { - //the realm with special characters in its id was successfully migrated (no error during migration) - //removing it now as testMigratedData() expects specific clients and roles - //we need to perform the removal via run on server to workaround escaping parameters when using rest call - testingClient.server().run(session -> { - RealmModel realm = session.realms().getRealmByName("test ' and ; and -- and \""); - new RealmManager(session).removeRealm(realm); - }); - - testMigratedData(); - testMigrationTo3_x(); - testMigrationTo4_x(); - testMigrationTo5_x(); - testMigrationTo6_x(); - testMigrationTo7_x(true); - testMigrationTo8_x(); - testMigrationTo9_x(); - testMigrationTo12_x(false); - testMigrationTo18_x(); - testMigrationTo19_x(); - testMigrationTo20_x(); - - // Always test offline-token login during migration test - testOfflineTokenLogin(); - } - - @Test - @Migration(versionPrefix = "1.") - @AuthServerContainerExclude(AuthServer.QUARKUS) - public void migration1_xTest() throws Exception { - testMigratedData(false); - testMigrationTo2_x(); - testMigrationTo3_x(); - testMigrationTo4_x(false, false); - testMigrationTo5_x(); - testMigrationTo6_x(); - testMigrationTo7_x(false); - testMigrationTo8_x(); - testMigrationTo9_x(); - testMigrationTo12_x(false); - testMigrationTo18_x(); - testMigrationTo19_x(); - testMigrationTo20_x(); - - // Always test offline-token login during migration test - testOfflineTokenLogin(); - } - } diff --git a/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml b/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml index 15c034bfb6..7fdefad093 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml +++ b/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml @@ -706,25 +706,6 @@ - - - ${auth.server.migration.legacy} - org.jboss.as.arquillian.container.managed.ManagedDeployableContainer - ${keycloak.migration.home} - - -Djboss.as.management.blocking.timeout=${auth.server.jboss.startup.timeout} - -Djboss.socket.binding.port-offset=${auth.server.port.offset} - ${migration.import.props.previous} - ${auth.server.memory.settings} - -Dauth.server.truststore=${auth.server.truststore} - -Dauth.server.truststore.password=${auth.server.truststore.password} - -Dauth.server.db.host=${auth.server.db.host} - - ${auth.server.management.port} - ${auth.server.jboss.startup.timeout} - - - ${auth.server.migration} diff --git a/testsuite/integration-arquillian/tests/pom.xml b/testsuite/integration-arquillian/tests/pom.xml index 22563d3259..31d6a7f197 100755 --- a/testsuite/integration-arquillian/tests/pom.xml +++ b/testsuite/integration-arquillian/tests/pom.xml @@ -1706,90 +1706,6 @@ - - - auth-server-migration-legacy - - target/test-classes/migration-test/migration-realm-${migrated.auth.server.version}.json - - -Dkeycloak.migration.action=import - -Dkeycloak.migration.provider=singleFile - -Dkeycloak.migration.file=${migration.import.file} - -Dkeycloak.migration.strategy=OVERWRITE_EXISTING - - true - - - - org.wildfly.arquillian - wildfly-arquillian-container-managed - - - - - - maven-enforcer-plugin - - - - enforce - - - - - migrated.auth.server.version - - - migration.mode - - - - - - - - - - - maven-dependency-plugin - - - unpack-migrated-auth-server-jboss - generate-resources - - unpack - - - - - org.keycloak.testsuite - integration-arquillian-migration-server-legacy - ${project.version} - zip - - - ${containers.home} - true - - - - - - maven-surefire-plugin - - - ${migrated.auth.server.version} - true - ${containers.home}/auth-server-migration-legacy - ${migration.import.props.previous} - - - - - - - - auth-server-migration