diff --git a/testsuite/integration-arquillian/README.md b/testsuite/integration-arquillian/README.md index 1adc0547bc..4a0cfa1e52 100644 --- a/testsuite/integration-arquillian/README.md +++ b/testsuite/integration-arquillian/README.md @@ -1,33 +1,36 @@ # Keycloak Arquillian Integration Testsuite +## Overview + +For overview see the **Modules Overview** section at the bottom of this README. + + ## Container Lifecycles -### Keycloak Auth Server +### Auth Server -There is only one instance of Keycloak server running during a single test run. -It is automatically started by Arquillian on the `BeforeSuite` event and stopped `AfterSuite`. +Keycloak server is automatically started by the testsuite on the `BeforeSuite` event and stopped on `AfterSuite` event. -The type of container can be determined by property `-Dauth.server.container`. Default value is `auth-server-undertow`, -other options are: `auth-server-wildfly` and `auth-server-eap7`. The values correspond to Arquillian *container qualifiers* in `arquillian.xml` config file. +By default the server runs in embedded Undertow. -**Note 1:** For the non-default options it's necessary to build a corresponding server module prior to running any of the test modules. -This can be done by building the server module directly (from `servers/wildfly`/`servers/eap7`), -or by activating `auth-server-wildfly`/`auth-server-eap7` profile when building from the top level module. +#### Wildfly/EAP -**Note 2:** Most server-side configurations are done during the build of the server module -and included in the output artifact - which is then consumed by the test modules( if a corresponding profile is activated). -To reflect a change in server config in the test (e.g. a datasource) it's necessary to rebuild the server module after each change. +Testsuite supports running server on Wildfly/EAP. For this it's necessary to: +- build the project including the `distribution` module + (artifact `keycloak-server-dist`/`-overlay` needs to be available before running the testsuite), +- activate profile `auth-server-wildfly` or `auth-server-eap7`. -#### Migration - -Migration tests can be enabled by setting `-Dmigrated.auth.server.version` property. Supported versions can be found at the bottom of `tests/pom.xml`. -When enabled, the `AuthServerTestEnricher` class will start and stop the selected migrated instance -*before* the current auth server instance is started. +[More details...](servers/auth-server/README.md) #### Cluster Setup -Cluster setup can be enabled with profile `auth-server-wildfly-cluster`. -(It is also necessary to build the server modules with this profile before running the test. See *Notes 1 and 2* above.) +The cluster setup for server can be enabled by activating profile `auth-server-cluster`. + +The cluster setup is not supported for server on Undetow. Profile `auth-server-wildfly` or `auth-server-eap` needs to be activated. + +The setup includes: +- a `mod_cluster` load balancer on Wildfly +- two clustered nodes of Keycloak server on Wildfly/EAP Clustering tests require MULTICAST to be enabled on machine's `loopback` network interface. This can be done by running the following commands under root privileges: @@ -36,20 +39,20 @@ route add -net 224.0.0.0 netmask 240.0.0.0 dev lo ifconfig lo multicast ``` -### App Servers +### App Servers / Adapter Tests Lifecycle of application server is always tied to a particular TestClass. Each *adapter* test class is annotated by `@AppServerContainer("app-server-*")` annotation that links it to a particular Arquillian container in `arquillian.xml`. -The `AppServerTestEnricher` then ensures the server is started before and stopped after all tests methods in the class. +The `AppServerTestEnricher` then ensures the server is started during `BeforeClass` event and stopped during `AfterClass` event for that particular test class. In case the `@AppServerContainer` annotation has no value it's assumed that the application container -is the same as the auth server container (a relative adapter test scenario). +is the same as the auth server container - a "relative" adapter test scenario. -Adapter tests are separated into submodules because different app containers require different configurations -(installation of adapter libs, etc.). -Container entries of app servers are not present in the main `arquillian.xml` in the `base` module. -Each adapter submodule adds it's own entry before it runs the tests. +The app-servers with installed Keycloak adapter are prepared in `servers/app-server` submodules, activated by `-Papp-server-MODULE`. +[More details.](servers/app-server/README.md) + +The corresponding adapter test modules are in `tests/other/adapters` submodules, and are activated by the same profiles. ## SuiteContext and TestContext @@ -130,32 +133,6 @@ It automatically modifies imported test realms and deployments' adapter configs 2. **Bundled** - In the deployed war in `/WEB-INF/keycloak.json`. **Default.** -## Maven Modules Structure - -``` -integration-arquillian -│ -├──servers -│ ├──wildfly (activated by -Pauth-server-wildfly) -│ └──eap7 (activated by -Pauth-server-eap7) -│ -└──tests (common settings for all test modules) - ├──base (custom ARQ extensions + base functional tests) - └──other (common settings for all modules dependent on base) - │ - ├──adapters (common settings for all adapter submodules) - │ ├──wildfly (activated by -Papp-server-wildfly) - │ ├──wildfly-relative (activated by -Papp-server-wildfly-relative,auth-server-wildfly) - │ ├──... - │ ├──tomcat (activated by -Papp-server-tomcat) - │ └──karaf (activated by -Papp-server-karaf) - │ - ├──console (activated by -Pconsole-ui-tests) - ├──mod_auth_mellon (activated by -Pmod_auth_mellon) - ├──console_no_users (activated by -Pconsole-ui-no-users-tests) - └──... -``` - ## Custom Arquillian Extensions Custom extensions are registered in `META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension`. @@ -173,6 +150,37 @@ Custom extensions are registered in `META-INF/services/org.jboss.arquillian.core * `DeploymentTargetModifier` - Ensures all test app deployments are targeted at app server containers. * `URLProvider` - Fixes URLs injected by Arquillian Graphene which contain value `127.0.0.1` instead of required `localhost`. -### CustomKarafContainerExtension +## Modules Overview + +``` +integration-arquillian +│ +├──servers (preconfigured test servers) +│ │ +│ ├──auth-server +│ │ ├──jboss (wildfly/eap) +│ │ └──undertow (arq. extension) +│ │ +│ ├──app-server +│ │ ├──jboss (wildfly/eap/as) +│ │ ├──tomcat +│ │ └──karaf +│ │ +│ └──wildfly-balancer +│ +└──tests (common settings for all test modules) + │ + ├──base (custom ARQ extensions + base functional tests) + │ + └──other (common settings for all test modules dependent on base) + │ + ├──adapters (common settings for all adapter test modules) + │ ├──jboss + │ ├──tomcat + │ └──karaf + │ + ├──console + ├──console_no_users + └──... +``` -Extension for executing karaf commands after container is started. Used for installation of bundles (test apps and adapter libs). \ No newline at end of file diff --git a/testsuite/integration-arquillian/servers/README.md b/testsuite/integration-arquillian/servers/README.md index 835e17105f..d29f470f69 100644 --- a/testsuite/integration-arquillian/servers/README.md +++ b/testsuite/integration-arquillian/servers/README.md @@ -1,6 +1,9 @@ -# Keycloak Arquillian Integration TestSuite +# Keycloak Arquillian Integration TestSuite - Test Servers -[Keycloak Arquillian Integration TestSuite](../README.md) +- [Keycloak Arquillian Integration TestSuite](../README.md) +- Keycloak Arquillian Integration TestSuite - Test Servers +- [Keycloak Arquillian Integration TestSuite - Test Servers - Auth Server](auth-server/README.md) +- [Keycloak Arquillian Integration TestSuite - Test Servers - App Servers](app-server/README.md) ## Test Servers @@ -14,8 +17,6 @@ The artifacts are used by the Arquillian TestSuite. - EAP 7 - Undertow -[Details...](auth-server/README.md) - ### App Server @@ -30,7 +31,6 @@ The artifacts are used by the Arquillian TestSuite. - Tomcat - Tomcat 7, 8 -[Details...](app-server/README.md) ### Load Balancer diff --git a/testsuite/integration-arquillian/servers/app-server/README.md b/testsuite/integration-arquillian/servers/app-server/README.md index 6905f037cd..008e4f594f 100644 --- a/testsuite/integration-arquillian/servers/app-server/README.md +++ b/testsuite/integration-arquillian/servers/app-server/README.md @@ -1,6 +1,9 @@ -# Keycloak Arquillian Integration TestSuite - Test Servers +# Keycloak Arquillian Integration TestSuite - Test Servers - App Servers -[Up...](../README.md) +- [Keycloak Arquillian Integration TestSuite](../../README.md) +- [Keycloak Arquillian Integration TestSuite - Test Servers](../README.md) +- [Keycloak Arquillian Integration TestSuite - Test Servers - Auth Server](../auth-server/README.md) +- Keycloak Arquillian Integration TestSuite - Test Servers - App Servers ## App Server - JBoss diff --git a/testsuite/integration-arquillian/servers/auth-server/README.md b/testsuite/integration-arquillian/servers/auth-server/README.md index 87f9a2072a..1fed446c35 100644 --- a/testsuite/integration-arquillian/servers/auth-server/README.md +++ b/testsuite/integration-arquillian/servers/auth-server/README.md @@ -1,16 +1,21 @@ -# Keycloak Arquillian Integration TestSuite - Test Servers +# Keycloak Arquillian Integration TestSuite - Test Servers - Auth Server -[Up...](../README.md) +- [Keycloak Arquillian Integration TestSuite](../../README.md) +- [Keycloak Arquillian Integration TestSuite - Test Servers](../README.md) +- Keycloak Arquillian Integration TestSuite - Test Servers - Auth Server +- [Keycloak Arquillian Integration TestSuite - Test Servers - App Servers](../app-server/README.md) -## Auth Server - JBoss `auth-server/jboss` +## Auth Server - JBoss -### Modules +Common configurations of Keycloak server on JBoss-based container (Wildfly/EAP). -* __`wildfly` Wildfly 10__ +### Submodules + +#### `wildfly` Wildfly 10 - Builds keycloak server on top of latest Wildfly. - Activated by __`-Pauth-server-wildfly`__ -* __`eap` EAP 7__ +#### `eap` EAP 7 - Builds keycloak server on top of latest EAP. - Activated by __`-Pauth-server-eap`__ - Requires access to product repo. @@ -39,6 +44,6 @@ Configures in `standalone-ha.xml`: See profile `auth-server-cluster`. -## Auth Server - Undertow `auth-server/undertow` +## Auth Server - Undertow Arquillian extension for running Keycloak server in embedded Undertow. diff --git a/testsuite/integration-arquillian/servers/auth-server/jboss/pom.xml b/testsuite/integration-arquillian/servers/auth-server/jboss/pom.xml index 97a18f1db8..c121fcab7b 100644 --- a/testsuite/integration-arquillian/servers/auth-server/jboss/pom.xml +++ b/testsuite/integration-arquillian/servers/auth-server/jboss/pom.xml @@ -57,6 +57,9 @@ ${auth.server.dist.version} ${project.build.directory}/unpacked/${auth.server.dist.unpacked.folder.name} + + + false @@ -268,6 +271,7 @@ jpa ${auth.server.home}/modules/system/layers/base/com/${jdbc.mvn.artifactId}/main + true @@ -344,7 +348,7 @@ ${auth.server.home}/modules/system/layers/base/com/h2database/h2/main - src/main/resources/module.xsl + src/main/resources/xslt/module.xsl module.xml @@ -366,6 +370,7 @@ ${common.resources}/datasource.xsl standalone.xml + standalone-ha.xml ${auth.server.home}/standalone/configuration @@ -421,14 +426,13 @@ xml-maven-plugin - configure-wildfly-datasource + jpa-h2-tcp process-resources transform - ${auth.server.home}/standalone/configuration @@ -447,6 +451,18 @@ + + ${skip.h2.tcp} + + + + keycloak-ispn-caches + process-resources + + transform + + + ${auth.server.home}/standalone/configuration diff --git a/testsuite/integration-arquillian/servers/auth-server/jboss/wildfly/src/main/xslt/module.xsl b/testsuite/integration-arquillian/servers/auth-server/jboss/wildfly/src/main/resources/xslt/module.xsl similarity index 100% rename from testsuite/integration-arquillian/servers/auth-server/jboss/wildfly/src/main/xslt/module.xsl rename to testsuite/integration-arquillian/servers/auth-server/jboss/wildfly/src/main/resources/xslt/module.xsl