-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration test for OIDC authentication
Co-authored-by: Steve Breker <[email protected]>
- Loading branch information
1 parent
46a1eb8
commit 937f41b
Showing
11 changed files
with
398 additions
and
13 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,34 @@ | ||
--- | ||
name: "OIDC Integration Test" | ||
on: | ||
workflow_dispatch: | ||
jobs: | ||
test: | ||
name: "Test" | ||
runs-on: "ubuntu-24.04" | ||
steps: | ||
- name: "Check out repository" | ||
uses: "actions/checkout@v4" | ||
- name: "Save user id" | ||
id: user_id | ||
run: | | ||
echo "user_id=$(id -u)" >> $GITHUB_OUTPUT | ||
- name: "Save group id" | ||
id: group_id | ||
run: | | ||
echo "group_id=$(id -g)" >> $GITHUB_OUTPUT | ||
- name: "Set up buildx" | ||
uses: "docker/setup-buildx-action@v3" | ||
- name: "Run tests" | ||
run: | | ||
./run.sh | ||
shell: "bash" | ||
working-directory: "tests/integration" | ||
env: | ||
USER_ID: ${{ steps.user_id.outputs.user_id }} | ||
GROUP_ID: ${{ steps.group_id.outputs.group_id }} | ||
UBUNTU_VERSION: "22.04" | ||
PYTHON_VERSION: "3.9" | ||
COMPOSE_DOCKER_CLI_BUILD: 1 | ||
DOCKER_BUILDKIT: 1 | ||
PYTEST_ADDOPTS: -vv |
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
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,84 @@ | ||
--- | ||
name: am-integration | ||
|
||
services: | ||
|
||
mysql: | ||
image: "percona:8.0" | ||
command: "--character-set-server=utf8mb4 --collation-server=utf8mb4_0900_ai_ci" | ||
environment: | ||
MYSQL_ROOT_PASSWORD: "root" | ||
# These are used in the settings.testmysql modules | ||
MYSQL_USER: "archivematica" | ||
MYSQL_PASSWORD: "demo" | ||
MYSQL_DATABASE: "test_DASHBOARDTEST" | ||
cap_add: | ||
- "SYS_NICE" | ||
healthcheck: | ||
test: ["CMD", "mysqladmin" ,"ping", "-h", "127.0.0.1"] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
start_period: 15s | ||
|
||
archivematica-dashboard: | ||
build: | ||
context: "../../" | ||
dockerfile: "hack/Dockerfile" | ||
args: | ||
TARGET: "archivematica-dashboard-integration-tests" | ||
USER_ID: ${USER_ID:-1000} | ||
GROUP_ID: ${GROUP_ID:-1000} | ||
UBUNTU_VERSION: ${UBUNTU_VERSION:-22.04} | ||
PYTHON_VERSION: ${PYTHON_VERSION:-3.9} | ||
command: ["pytest", "--browser", "firefox", "/src/tests/integration/"] | ||
hostname: "archivematica-dashboard" | ||
environment: | ||
PYTEST_ADDOPTS: ${PYTEST_ADDOPTS:-} | ||
RUN_INTEGRATION_TESTS: "true" | ||
DJANGO_LIVE_TEST_SERVER_ADDRESS: "archivematica-dashboard:8000" | ||
DJANGO_ALLOW_ASYNC_UNSAFE: true | ||
FORWARDED_ALLOW_IPS: "*" | ||
AM_GUNICORN_ACCESSLOG: "/dev/null" | ||
AM_GUNICORN_RELOAD: "true" | ||
AM_GUNICORN_RELOAD_ENGINE: "auto" | ||
DJANGO_SETTINGS_MODULE: "settings.testmysql" | ||
ARCHIVEMATICA_DASHBOARD_DASHBOARD_GEARMAN_SERVER: "gearmand:4730" | ||
ARCHIVEMATICA_DASHBOARD_DASHBOARD_ELASTICSEARCH_SERVER: "elasticsearch:9200" | ||
ARCHIVEMATICA_DASHBOARD_DASHBOARD_PROMETHEUS_ENABLED: "1" | ||
ARCHIVEMATICA_DASHBOARD_CLIENT_USER: "archivematica" | ||
ARCHIVEMATICA_DASHBOARD_CLIENT_PASSWORD: "demo" | ||
ARCHIVEMATICA_DASHBOARD_CLIENT_HOST: "mysql" | ||
ARCHIVEMATICA_DASHBOARD_CLIENT_DATABASE: "MCP" | ||
ARCHIVEMATICA_DASHBOARD_SEARCH_ENABLED: "${AM_SEARCH_ENABLED:-true}" | ||
ARCHIVEMATICA_DASHBOARD_OIDC_AUTHENTICATION: "true" | ||
OIDC_RP_CLIENT_ID: "am-dashboard" | ||
OIDC_RP_CLIENT_SECRET: "example-secret" | ||
OIDC_OP_AUTHORIZATION_ENDPOINT: "http://keycloak:8080/realms/demo/protocol/openid-connect/auth" | ||
OIDC_OP_TOKEN_ENDPOINT: "http://keycloak:8080/realms/demo/protocol/openid-connect/token" | ||
OIDC_OP_USER_ENDPOINT: "http://keycloak:8080/realms/demo/protocol/openid-connect/userinfo" | ||
OIDC_OP_JWKS_ENDPOINT: "http://keycloak:8080/realms/demo/protocol/openid-connect/certs" | ||
OIDC_OP_LOGOUT_ENDPOINT: "http://keycloak:8080/realms/demo/protocol/openid-connect/logout" | ||
OIDC_RP_SIGN_ALGO: "RS256" | ||
volumes: | ||
- "../../:/src" | ||
depends_on: | ||
mysql: | ||
condition: service_healthy | ||
links: | ||
- "mysql" | ||
- "keycloak" | ||
|
||
keycloak: | ||
image: "quay.io/keycloak/keycloak:latest" | ||
command: ["start-dev", "--import-realm"] | ||
restart: "unless-stopped" | ||
environment: | ||
KEYCLOAK_ADMIN: "admin" | ||
KEYCLOAK_ADMIN_PASSWORD: "admin" | ||
KC_METRICS_ENABLED: true | ||
KC_LOG_LEVEL: "INFO" | ||
ports: | ||
- 8080:8080 | ||
volumes: | ||
- "./etc/keycloak/realm.json:/opt/keycloak/data/import/realm.json:ro" |
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,52 @@ | ||
[ | ||
{ | ||
"id": "demo", | ||
"realm": "demo", | ||
"sslRequired": "none", | ||
"enabled": true, | ||
"eventsEnabled": true, | ||
"eventsExpiration": 900, | ||
"adminEventsEnabled": true, | ||
"adminEventsDetailsEnabled": true, | ||
"attributes": { | ||
"adminEventsExpiration": "900" | ||
}, | ||
"clients": [ | ||
{ | ||
"id": "am-dashboard", | ||
"clientId": "am-dashboard", | ||
"name": "am-dashboard", | ||
"enabled": true, | ||
"rootUrl": "http://archivematica-dashboard:8000", | ||
"adminUrl": "http://archivematica-dashboard:8000", | ||
"baseUrl": "http://archivematica-dashboard:8000", | ||
"clientAuthenticatorType": "client-secret", | ||
"secret": "example-secret", | ||
"redirectUris": ["http://archivematica-dashboard:8000/*"], | ||
"webOrigins": ["http://archivematica-dashboard:8000"], | ||
"standardFlowEnabled": true, | ||
"serviceAccountsEnabled": true, | ||
"authorizationServicesEnabled": true, | ||
"publicClient": false | ||
} | ||
], | ||
"users": [ | ||
{ | ||
"id": "demo", | ||
"email": "[email protected]", | ||
"username": "demo", | ||
"firstName": "Demo", | ||
"lastName": "User", | ||
"enabled": true, | ||
"emailVerified": true, | ||
"credentials": [ | ||
{ | ||
"temporary": false, | ||
"type": "password", | ||
"value": "demo" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] |
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,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
|
||
cd ${__dir} | ||
|
||
docker compose build archivematica-dashboard | ||
|
||
status=$? | ||
|
||
if [ $status -ne 0 ]; then | ||
exit $status | ||
fi | ||
|
||
docker compose run --rm archivematica-dashboard | ||
|
||
status=$? | ||
|
||
if [ -z "${REUSE_TEST_ENV}" ]; then | ||
docker compose down --volumes | ||
fi | ||
|
||
exit $status |
Oops, something went wrong.