Cross-DC Functional Testing

Validate the Cross Data Center functionality of Keycloak in an actual cross data center setup for Keycloak application. As part of that, we created a test suite currently hosted in the keycloak-benchmark-crossdc-tests.

CrossDC Test Framework

The current framework is made up of the below components:

Testsuite root directory

keycloak-benchmark/provision/rosa-cross-dc

Test Runner

JUnit5.

Test Data

Use Dataset Provider.

Cache Metrics

ISPN Http REST client to access Cache stats for external ISPN server. And for the embedded Infinispan cache, we are relying on the Dataset Provider.

Execution Target

A CrossDC cluster with access to two Keycloak and Infinispan datacenter URLs.

We will use the existing ROSA OCP cluster based deployment during development to bring up the cross-dc cluster.

How to run

From the Testsuite root directory run the below command to run the tests

mvn clean install -DcrossDCTests \
  -Dmain.password=<PASSWORD> \(1)
  -Ddeployment.type=active-active|active-passive \(2)
  -Ddeployment.namespace=runner-keycloak \(3)
  -Dkubernetes.1.context=<CONTEXT_1> \(4)
  -Dkubernetes.2.context=<CONTEXT_1> (5)
1 The main password of the Keycloak deployment
2 The type of deployment to be tests, it can be either "active-active" or "active-passive". If omitted, defaults to "active-passive".
3 The namespace containing the Keycloak deployment in the Kubernetes clusters specified in 4 & 5.
4 The Kubeconfig context of cluster 1
5 The Kubeconfig context of cluster 2

Alternatively you can use the run-crossdc-tests.sh (located in the Testsuite root) directory to execute the tests when using a ROSA style provisioning setup to fetch the MAIN_PASSWORD on the fly.

Example usage:

ACTIVE_ACTIVE=true|false \
DEPLOYMENT_NAMESPACE=runner-keycloak \
KUBERNETES_1_CONTEXT=<CONTEXT_1> \
KUBERNETES_2_CONTEXT=<CONTEXT_2> \
./run-crossdc-tests.sh