-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CrossDC functional test suite automation (#589)
* initial work Signed-off-by: Martin Kanis <mkanis@redhat.com> * Stretch attempt to add an GHA to run the CrossDC functional tests Signed-off-by: Kamesh Akella <kamesh.asp@gmail.com> --------- Signed-off-by: Martin Kanis <mkanis@redhat.com> Signed-off-by: Kamesh Akella <kamesh.asp@gmail.com> Co-authored-by: Kamesh Akella <kakella@redhat.com> Co-authored-by: TTomáš Kyjovský <tkyjovsk@redhat.com@redhat.com>
- Loading branch information
1 parent
06f22fa
commit d6895df
Showing
12 changed files
with
735 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Run CrossDC functional tests on ROSA cluster | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
clusterPrefix: | ||
description: 'The prefix used when creating the Cross DC clusters' | ||
type: string | ||
|
||
concurrency: | ||
# Only run once for the latest commit per ref and cancel other (previous) runs. | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '21' | ||
cache: 'maven' | ||
- name: Cache Maven Wrapper | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
.mvn/wrapper/maven-wrapper.jar | ||
key: ${{ runner.os }}-maven-wrapper-${{ hashFiles('**/maven-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven-wrapper- | ||
- name: Setup ROSA CLI | ||
uses: ./.github/actions/rosa-cli-setup | ||
with: | ||
aws-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-default-region: ${{ vars.AWS_DEFAULT_REGION }} | ||
rosa-token: ${{ secrets.ROSA_TOKEN }} | ||
- name: Login to OpenShift cluster A | ||
uses: ./.github/actions/oc-keycloak-login | ||
with: | ||
clusterName: ${{ inputs.clusterPrefix }}-a | ||
- name: Get DC1 URLs | ||
shell: bash | ||
run: | | ||
KEYCLOAK_DC1_URL=https://$(kubectl get routes -n "${{ inputs.project }}" -l app=keycloak -o jsonpath='{.items[*].spec.host}') | ||
echo "KEYCLOAK_DC1_URL=$KEYCLOAK_DC1_URL" >> "$GITHUB_ENV" | ||
ISPN_DC1_URL=https://$(kubectl get routes -n "${{ inputs.project }}" -l app=infinispan-service-external -o jsonpath='{.items[*].spec.host}') | ||
echo "ISPN_DC1_URL=$ISPN_DC1_URL" >> "$GITHUB_ENV" | ||
- name: Login to OpenShift cluster B | ||
uses: ./.github/actions/oc-keycloak-login | ||
with: | ||
clusterName: ${{ inputs.clusterPrefix }}-b | ||
- name: Get DC2 URLs | ||
shell: bash | ||
run: | | ||
KEYCLOAK_DC2_URL=https://$(kubectl get routes -n "${{ inputs.project }}" -l app=keycloak -o jsonpath='{.items[*].spec.host}') | ||
echo "KEYCLOAK_DC2_URL=$KEYCLOAK_DC1_URL" >> "$GITHUB_ENV" | ||
ISPN_DC2_URL=https://$(kubectl get routes -n "${{ inputs.project }}" -l app=infinispan-service-external -o jsonpath='{.items[*].spec.host}') | ||
echo "ISPN_DC2_URL=$ISPN_DC1_URL" >> "$GITHUB_ENV" | ||
- name: Run CrossDC functional tests | ||
working-directory: provision/rosa-cross-dc/keycloak-benchmark-crossdc-tests | ||
run: | | ||
./run-crossdc-tests.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
provision/rosa-cross-dc/keycloak-benchmark-crossdc-tests/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
### Motivation | ||
|
||
We wanted to 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 that is currently hosted in the keycloak-benchmark and in future would move to a more appropriate place. | ||
|
||
### 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 [Keycloak Dataset provider](https://www.keycloak.org/keycloak-benchmark/dataset-guide/latest/). | ||
- **Cache Metrics**: [ISPN Http REST client](https://infinispan.org/docs/stable/titles/rest/rest.html) to access Cache stats for external ISPN server. And for embedded infinispan cache we are relying on [Dataset provider](https://www.keycloak.org/keycloak-benchmark/dataset-guide/latest/). | ||
- **Execution Target**: A CrossDC cluster with access to two Keycloak and Infinispan datacenter urls. | ||
|
||
<br/> Note: 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 \ | ||
-Dinfinispan.dc1.url=<ISPN_DC1_URL> -Dkeycloak.dc1.url=<KEYCLOAK_DC1_URL> \ | ||
-Dinfinispan.dc2.url=<ISPN_DC2_URL> -Dkeycloak.dc2.url=<KEYCLOAK_DC2_URL>\ | ||
-Dinfinispan.password=<ISPN_PASSWORD> | ||
``` | ||
|
||
Alternatively could 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 `ISPN_PASSWORD` on the fly, or by setting it manually. | ||
|
||
Example usage: | ||
``` | ||
ISPN_DC1_URL=<ISPN_DC1_URL> ISPN_DC2_URL=<ISPN_DC2_URL> \ | ||
KEYCLOAK_DC1_URL=<KEYCLOAK_DC1_URL> KEYCLOAK_DC2_URL=<KEYCLOAK_DC2_URL> \ | ||
./run-crossdc-tests.sh | ||
``` |
Oops, something went wrong.