Skip to content

Commit

Permalink
Fix molecule tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hwo-wd committed Jan 9, 2025
1 parent e029e1c commit 1bf21bd
Show file tree
Hide file tree
Showing 25 changed files with 50 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ docs/_build/
changelogs/.plugin-cache.yaml
*.pem
*.key
*.p12
*.p12
5 changes: 4 additions & 1 deletion molecule/debian/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
keycloak_quarkus_show_deprecation_warnings: false
keycloak_quarkus_bootstrap_admin_password: "remembertochangeme"
keycloak_quarkus_bootstrap_admin_user: "remembertochangeme"
keycloak_quarkus_hostname: http://instance
keycloak_quarkus_hostname: http://instance:8080
keycloak_quarkus_log: file
keycloak_quarkus_start_dev: true
keycloak_quarkus_proxy_mode: none
roles:
- role: keycloak_quarkus
- role: keycloak_realm
keycloak_url: "{{ keycloak_quarkus_hostname }}"
keycloak_context: ''
keycloak_admin_user: "{{ keycloak_quarkus_bootstrap_admin_user }}"
keycloak_admin_password: "{{ keycloak_quarkus_bootstrap_admin_password }}"
keycloak_client_users:
- username: TestUser
password: password
Expand Down
1 change: 1 addition & 0 deletions molecule/debian/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
ansible.builtin.apt:
name:
- sudo
# - openjdk-21-jdk-headless # this is not available in ghcr.io/hspaans/molecule-containers:debian-11 (neither in debian-12) since the images are using outdated package sources
- openjdk-17-jdk-headless
state: present
5 changes: 4 additions & 1 deletion molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
keycloak_quarkus_show_deprecation_warnings: false
keycloak_quarkus_bootstrap_admin_password: "remembertochangeme"
keycloak_quarkus_bootstrap_admin_user: "remembertochangeme"
keycloak_quarkus_hostname: http://instance
keycloak_quarkus_hostname: http://instance:8080
keycloak_quarkus_log: file
keycloak_quarkus_log_level: debug
keycloak_quarkus_log_target: /tmp/keycloak
Expand All @@ -16,7 +16,10 @@
roles:
- role: keycloak_quarkus
- role: keycloak_realm
keycloak_url: "{{ keycloak_quarkus_hostname }}"
keycloak_context: ''
keycloak_admin_user: "{{ keycloak_quarkus_bootstrap_admin_user }}"
keycloak_admin_password: "{{ keycloak_quarkus_bootstrap_admin_password }}"
keycloak_client_users:
- username: TestUser
password: password
Expand Down
1 change: 1 addition & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ platforms:
- "8080/tcp"
- "8443/tcp"
- "8009/tcp"
- "9000/tcp"
provisioner:
name: ansible
config_options:
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

- name: Download keycloak archive to controller directory
ansible.builtin.get_url: # noqa risky-file-permissions delegated, uses controller host user
url: https://github.com/keycloak/keycloak/releases/download/24.0.5/keycloak-24.0.5.zip
url: https://github.com/keycloak/keycloak/releases/download/26.0.7/keycloak-26.0.7.zip
dest: /tmp/keycloak
mode: '0640'
delegate_to: localhost
Expand Down
3 changes: 2 additions & 1 deletion molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- name: Verify
hosts: all
vars:
keycloak_quarkus_bootstrap_admin_password: "remembertochangeme"
keycloak_quarkus_bootstrap_admin_user: "remembertochangeme"
keycloak_uri: "http://localhost:8080"
tasks:
Expand All @@ -16,7 +17,7 @@
ansible.builtin.uri:
url: "{{ keycloak_uri }}/realms/master/protocol/openid-connect/token"
method: POST
body: "client_id=admin-cli&username=admin&password={{ keycloak_quarkus_bootstrap_admin_user }}&grant_type=password"
body: "client_id=admin-cli&username={{ keycloak_quarkus_bootstrap_admin_user }}&password={{ keycloak_quarkus_bootstrap_admin_user }}&grant_type=password"
validate_certs: no
register: keycloak_auth_response
until: keycloak_auth_response.status == 200
Expand Down
5 changes: 2 additions & 3 deletions molecule/https_revproxy/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
keycloak_quarkus_show_deprecation_warnings: false
keycloak_quarkus_bootstrap_admin_password: "remembertochangeme"
keycloak_quarkus_bootstrap_admin_user: "remembertochangeme"
keycloak_realm: TestRealm
keycloak_quarkus_hostname: http://instance
keycloak_quarkus_hostname: https://proxy
keycloak_quarkus_log: file
keycloak_quarkus_http_enabled: True
keycloak_quarkus_http_port: 8080
keycloak_quarkus_proxy_mode: edge
keycloak_quarkus_http_relative_path: /
keycloak_quarkus_frontend_url: https://proxy/
keycloak_quarkus_health_check_url: http://proxy:8080/realms/master/.well-known/openid-configuration
roles:
- role: keycloak_quarkus
1 change: 1 addition & 0 deletions molecule/overridexml/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ platforms:
- "8080/tcp"
- "8443/tcp"
- "8009/tcp"
- "9000/tcp"
provisioner:
name: ansible
config_options:
Expand Down
5 changes: 4 additions & 1 deletion molecule/quarkus-devmode/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
keycloak_quarkus_bootstrap_admin_user: "remembertochangeme"
keycloak_realm: TestRealm
keycloak_quarkus_log: file
keycloak_quarkus_frontend_url: 'http://localhost:8080/'
keycloak_quarkus_hostname: 'http://localhost:8080'
keycloak_quarkus_start_dev: True
keycloak_quarkus_proxy_mode: none
keycloak_quarkus_java_home: /opt/openjdk/
roles:
- role: keycloak_quarkus
- role: keycloak_realm
keycloak_url: "{{ keycloak_quarkus_hostname }}"
keycloak_context: ''
keycloak_admin_user: "{{ keycloak_quarkus_bootstrap_admin_user }}"
keycloak_admin_password: "{{ keycloak_quarkus_bootstrap_admin_password }}"
keycloak_client_default_roles:
- TestRoleAdmin
- TestRoleUser
Expand Down
2 changes: 2 additions & 0 deletions molecule/quarkus-devmode/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ platforms:
port_bindings:
- "8080/tcp"
- "8009/tcp"
- "9000/tcp"
published_ports:
- 0.0.0.0:8080:8080/tcp
- 0.0.0.0:9000:9000/TCP
provisioner:
name: ansible
config_options:
Expand Down
7 changes: 5 additions & 2 deletions molecule/quarkus/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
keycloak_quarkus_bootstrap_admin_password: "remembertochangeme"
keycloak_quarkus_bootstrap_admin_user: "remembertochangeme"
keycloak_realm: TestRealm
keycloak_quarkus_hostname: http://instance
keycloak_quarkus_hostname: https://instance:8443
keycloak_quarkus_log: file
keycloak_quarkus_log_level: debug # needed for the verify step
keycloak_quarkus_https_key_file_enabled: true
Expand Down Expand Up @@ -37,7 +37,7 @@
repository_url: https://repo1.maven.org/maven2/ # https://mvnrepository.com/artifact/org.keycloak/keycloak-kerberos-federation/24.0.4
group_id: org.keycloak
artifact_id: keycloak-kerberos-federation
version: 24.0.5 # optional
version: 26.0.7 # optional
# username: myUser # optional
# password: myPAT # optional
# - id: my-static-theme
Expand All @@ -51,7 +51,10 @@
roles:
- role: keycloak_quarkus
- role: keycloak_realm
keycloak_url: "{{ keycloak_quarkus_hostname }}"
keycloak_context: ''
keycloak_admin_user: "{{ keycloak_quarkus_bootstrap_admin_user }}"
keycloak_admin_password: "{{ keycloak_quarkus_bootstrap_admin_password }}"
keycloak_client_default_roles:
- TestRoleAdmin
- TestRoleUser
Expand Down
1 change: 1 addition & 0 deletions molecule/quarkus/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ platforms:
- "8080/tcp"
- "8443/tcp"
- "8009/tcp"
- "9000/tcp"
published_ports:
- 0.0.0.0:8443:8443/tcp
provisioner:
Expand Down
2 changes: 1 addition & 1 deletion molecule/quarkus/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
- name: Make sure a jre is available (for keytool to prepare keystore)
delegate_to: localhost
ansible.builtin.package:
name: "{{ 'java-17-openjdk-headless' if hera_home | length > 0 else 'openjdk-17-jdk-headless' }}"
name: "{{ 'java-21-openjdk-headless' if hera_home | length > 0 else 'openjdk-21-jdk-headless' }}"
state: present
become: true
failed_when: false
Expand Down
13 changes: 7 additions & 6 deletions molecule/quarkus/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
- name: Verify
hosts: all
vars:
keycloak_quarkus_bootstrap_admin_user: "remembertochangeme"
keycloak_quarkus_bootstrap_admin_password: "remembertochangeme"
keycloak_quarkus_bootstrap_admin_user: "remembertochangeme"
tasks:
- name: Populate service facts
ansible.builtin.service_facts:
Expand Down Expand Up @@ -35,10 +36,10 @@
- name: Verify endpoint URLs
ansible.builtin.assert:
that:
- (openid_config.stdout | from_json)["backchannel_authentication_endpoint"] == 'https://instance/realms/master/protocol/openid-connect/ext/ciba/auth'
- (openid_config.stdout | from_json)['issuer'] == 'https://instance/realms/master'
- (openid_config.stdout | from_json)['authorization_endpoint'] == 'https://instance/realms/master/protocol/openid-connect/auth'
- (openid_config.stdout | from_json)['token_endpoint'] == 'https://instance/realms/master/protocol/openid-connect/token'
- (openid_config.stdout | from_json)["backchannel_authentication_endpoint"] == 'https://instance:8443/realms/master/protocol/openid-connect/ext/ciba/auth'
- (openid_config.stdout | from_json)['issuer'] == 'https://instance:8443/realms/master'
- (openid_config.stdout | from_json)['authorization_endpoint'] == 'https://instance:8443/realms/master/protocol/openid-connect/auth'
- (openid_config.stdout | from_json)['token_endpoint'] == 'https://instance:8443/realms/master/protocol/openid-connect/token'
delegate_to: localhost

- name: Check log folder
Expand Down Expand Up @@ -91,7 +92,7 @@
ansible.builtin.uri:
url: "https://instance:8443/realms/master/protocol/openid-connect/token"
method: POST
body: "client_id=admin-cli&username=admin&password={{ keycloak_quarkus_bootstrap_admin_user }}&grant_type=password"
body: "client_id=admin-cli&username={{ keycloak_quarkus_bootstrap_admin_user }}&password={{ keycloak_quarkus_bootstrap_admin_password}}&grant_type=password"
validate_certs: no
register: keycloak_auth_response
until: keycloak_auth_response.status == 200
Expand Down
3 changes: 1 addition & 2 deletions molecule/quarkus_ha/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
keycloak_quarkus_show_deprecation_warnings: false
keycloak_quarkus_bootstrap_admin_password: "remembertochangeme"
keycloak_quarkus_bootstrap_admin_user: "remembertochangeme"
keycloak_realm: TestRealm
keycloak_quarkus_hostname: "http://{{ inventory_hostname }}"
keycloak_quarkus_hostname: "http://{{ inventory_hostname }}:8080"
keycloak_quarkus_log: file
keycloak_quarkus_log_level: info
keycloak_quarkus_https_key_file_enabled: true
Expand Down
2 changes: 2 additions & 0 deletions molecule/quarkus_ha/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ platforms:
port_bindings:
- "8080/tcp"
- "8443/tcp"
- "9000/tcp"
- name: instance2
image: registry.access.redhat.com/ubi9/ubi-init:latest
pre_build_image: true
Expand All @@ -26,6 +27,7 @@ platforms:
port_bindings:
- "8080/tcp"
- "8443/tcp"
- "9000/tcp"
- name: postgres
image: ubuntu/postgres:14-22.04_beta
pre_build_image: true
Expand Down
2 changes: 1 addition & 1 deletion molecule/quarkus_upgrade/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
- vars.yml
vars:
keycloak_quarkus_show_deprecation_warnings: false
keycloak_quarkus_version: 24.0.3
keycloak_quarkus_version: 26.0.7
roles:
- role: keycloak_quarkus
2 changes: 2 additions & 0 deletions molecule/quarkus_upgrade/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ platforms:
privileged: true
port_bindings:
- 8080:8080
- "9000/tcp"
published_ports:
- 0.0.0.0:8080:8080/TCP
- 0.0.0.0:9000:9000/TCP
provisioner:
name: ansible
playbooks:
Expand Down
2 changes: 1 addition & 1 deletion molecule/quarkus_upgrade/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- vars.yml
vars:
sudo_pkg_name: sudo
keycloak_quarkus_version: 23.0.7
keycloak_quarkus_version: 24.0.5
pre_tasks:
- name: Install sudo
ansible.builtin.apt:
Expand Down
2 changes: 1 addition & 1 deletion molecule/quarkus_upgrade/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
keycloak_quarkus_offline_install: false
keycloak_quarkus_bootstrap_admin_password: "remembertochangeme"
keycloak_quarkus_realm: TestRealm
keycloak_quarkus_hostname: http://instance
keycloak_quarkus_hostname: http://instance:8080
keycloak_quarkus_log: file
keycloak_quarkus_https_key_file_enabled: true
keycloak_quarkus_log_target: /tmp/keycloak
Expand Down
2 changes: 1 addition & 1 deletion molecule/quarkus_upgrade/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- name: Verify we are running on requested jvm
ansible.builtin.shell: |
set -eo pipefail
ps -ef | grep 'etc/alternatives/.*17' | grep -v grep
ps -ef | grep 'etc/alternatives/.*21' | grep -v grep
changed_when: false

- name: Verify token api call
Expand Down
2 changes: 1 addition & 1 deletion roles/keycloak_quarkus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Role Defaults
|`keycloak_quarkus_service_restart_always`| systemd restart always behavior activation | `False` |
|`keycloak_quarkus_service_restart_on_failure`| systemd restart on-failure behavior activation | `False` |
|`keycloak_quarkus_service_restartsec`| systemd RestartSec | `10s` |
|`keycloak_quarkus_jvm_package`| RHEL java package runtime | `java-17-openjdk-headless` |
|`keycloak_quarkus_jvm_package`| RHEL java package runtime | `java-21-openjdk-headless` |
|`keycloak_quarkus_java_home`| JAVA_HOME of installed JRE, leave empty for using specified keycloak_quarkus_jvm_package RPM path | `None` |
|`keycloak_quarkus_java_heap_opts`| Heap memory JVM setting | `-Xms1024m -Xmx2048m` |
|`keycloak_quarkus_java_jvm_opts`| Other JVM settings | same as keycloak |
Expand Down
4 changes: 2 additions & 2 deletions roles/keycloak_quarkus/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ argument_specs:
description: "Perform an offline install"
type: "bool"
keycloak_quarkus_jvm_package:
default: "java-11-openjdk-headless"
default: "java-21-openjdk-headless"
description: "RHEL java package runtime"
type: "str"
keycloak_quarkus_java_home:
Expand Down Expand Up @@ -479,7 +479,7 @@ argument_specs:
downstream:
options:
rhbk_version:
default: "26.0.6"
default: "26.0.7"
description: "Red Hat Build of Keycloak version"
type: "str"
rhbk_archive:
Expand Down
2 changes: 1 addition & 1 deletion roles/keycloak_quarkus/vars/redhat.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
keycloak_quarkus_varjvm_package: "{{ keycloak_quarkus_jvm_package | default('java-17-openjdk-headless') }}"
keycloak_quarkus_varjvm_package: "{{ keycloak_quarkus_jvm_package | default('java-21-openjdk-headless') }}"
keycloak_quarkus_prereq_package_list:
- "{{ keycloak_quarkus_varjvm_package }}"
- unzip
Expand Down

0 comments on commit 1bf21bd

Please sign in to comment.