[PR #9727/910c57aa backport][stable-8] keycloak: repair integration tests by removing jinja2 templating from conditionals (#9726) (#9746)

keycloak: repair integration tests by removing jinja2 templating from conditionals (#9726) (#9727)

* fix: remove jinja2 templating from conditionals in keycloak_role module integration tests (#9726)

* fix: remove jinja2 templating in conditional in keycloak clientsecret info integration test (#9726)

This test needs a further fix; see #9744. Left for a future PR for now.

* fix: remove jinja2 templating in conditional in keycloak clientsecret regenerate integration test (#9726)

* chore: remove jinja2 templating in conditional in keycloak user federation integration test (#9726)

These instances of templating were not causing failures,
but this removes the warnings.

* chore: remove jinja2 templating in conditional in keycloak user rolemapping integration test (#9726)

These instances of templating were not causing failures,
but this removes the warnings.

* docs: add changelog fragment (#9726)

* docs: repair changelog fragment yaml (#9726)

* docs: actually repair changelog fragment yaml (#9726)

* chore: remove changelog fragment for test only pr (#9726)

(cherry picked from commit 910c57aaa0)

Co-authored-by: Mark Armstrong <markparmstrong@gmail.com>
pull/9791/head
patchback[bot] 2025-02-15 12:31:34 +01:00 committed by GitHub
parent 52d6cc42b5
commit c39deafa32
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 26 additions and 26 deletions

View File

@ -32,7 +32,7 @@
assert:
that:
- fetch_by_client_id_result.clientsecret_info.type == "secret"
- "{{ fetch_by_client_id_result.clientsecret_info.value | length }} >= 32"
- fetch_by_client_id_result.clientsecret_info.value | length >= 32
- name: Keycloak Client fetch clientsecret by id
community.general.keycloak_clientsecret_info: "{{ auth_args | combine(call_args) }}"

View File

@ -32,7 +32,7 @@
assert:
that:
- regenerate_by_client_id.end_state.type == "secret"
- "{{ regenerate_by_client_id.end_state.value | length }} >= 32"
- regenerate_by_client_id.end_state.value | length >= 32
- name: Keycloak Client regenerate clientsecret by id
community.general.keycloak_clientsecret_regenerate: "{{ auth_args | combine(call_args) }}"
@ -45,5 +45,5 @@
- name: Assert that client secret was regenerated
assert:
that:
- "{{ regenerate_by_id.end_state.value | length }} >= 32"
- regenerate_by_id.end_state.value | length >= 32
- regenerate_by_id.end_state.value != regenerate_by_client_id.end_state.value

View File

@ -45,8 +45,8 @@
that:
- result is changed
- result.existing == {}
- result.end_state.name == "{{ role }}"
- result.end_state.containerId == "{{ realm }}"
- result.end_state.name == role
- result.end_state.containerId == realm
- name: Create existing realm role
community.general.keycloak_role:
@ -89,8 +89,8 @@
assert:
that:
- result is changed
- result.existing.description == "{{ description_1 }}"
- result.end_state.description == "{{ description_2 }}"
- result.existing.description == description_1
- result.end_state.description == description_2
- name: Delete existing realm role
community.general.keycloak_role:
@ -156,8 +156,8 @@
that:
- result is changed
- result.existing == {}
- result.end_state.name == "{{ role }}"
- result.end_state.containerId == "{{ client.end_state.id }}"
- result.end_state.name == role
- result.end_state.containerId == client.end_state.id
- name: Create existing client role
community.general.keycloak_role:
@ -202,8 +202,8 @@
assert:
that:
- result is changed
- result.existing.description == "{{ description_1 }}"
- result.end_state.description == "{{ description_2 }}"
- result.existing.description == description_1
- result.end_state.description == description_2
- name: Delete existing client role
community.general.keycloak_role:
@ -480,4 +480,4 @@
assert:
that:
- result is not changed
- result.end_state == {}
- result.end_state == {}

View File

@ -64,7 +64,7 @@
that:
- result is changed
- result.existing == {}
- result.end_state.name == "{{ federation }}"
- result.end_state.name == federation
- name: Create new user federation in admin realm
community.general.keycloak_user_federation:
@ -117,7 +117,7 @@
that:
- result is changed
- result.existing == {}
- result.end_state.name == "{{ federation }}"
- result.end_state.name == federation
- name: Update existing user federation (no change)
community.general.keycloak_user_federation:
@ -170,9 +170,9 @@
that:
- result is not changed
- result.existing != {}
- result.existing.name == "{{ federation }}"
- result.existing.name == federation
- result.end_state != {}
- result.end_state.name == "{{ federation }}"
- result.end_state.name == federation
- name: Update existing user federation (no change, admin realm)
community.general.keycloak_user_federation:
@ -225,9 +225,9 @@
that:
- result is not changed
- result.existing != {}
- result.existing.name == "{{ federation }}"
- result.existing.name == federation
- result.end_state != {}
- result.end_state.name == "{{ federation }}"
- result.end_state.name == federation
- name: Update existing user federation (with change)
community.general.keycloak_user_federation:
@ -296,9 +296,9 @@
that:
- result is changed
- result.existing != {}
- result.existing.name == "{{ federation }}"
- result.existing.name == federation
- result.end_state != {}
- result.end_state.name == "{{ federation }}"
- result.end_state.name == federation
- name: Delete existing user federation
community.general.keycloak_user_federation:
@ -411,7 +411,7 @@
that:
- result is changed
- result.existing == {}
- result.end_state.name == "{{ federation }}"
- result.end_state.name == federation
## no point in retesting this, just doing it to clean up introduced server changes
- name: Delete absent user federation

View File

@ -53,7 +53,7 @@
assert:
that:
- result is changed
- result.end_state | selectattr("clientRole", "eq", false) | selectattr("name", "eq", "{{role}}") | list | count > 0
- result.end_state | selectattr("clientRole", "eq", false) | selectattr("name", "eq", role) | list | count > 0
- name: Unmap a realm role from client service account
vars:
@ -74,8 +74,8 @@
that:
- result is changed
- (result.end_state | length) == (result.existing | length) - 1
- result.existing | selectattr("clientRole", "eq", false) | selectattr("name", "eq", "{{role}}") | list | count > 0
- result.end_state | selectattr("clientRole", "eq", false) | selectattr("name", "eq", "{{role}}") | list | count == 0
- result.existing | selectattr("clientRole", "eq", false) | selectattr("name", "eq", role) | list | count > 0
- result.end_state | selectattr("clientRole", "eq", false) | selectattr("name", "eq", role) | list | count == 0
- name: Delete existing realm role
community.general.keycloak_role:
@ -118,7 +118,7 @@
assert:
that:
- result is changed
- result.end_state | selectattr("clientRole", "eq", true) | selectattr("name", "eq", "{{role}}") | list | count > 0
- result.end_state | selectattr("clientRole", "eq", true) | selectattr("name", "eq", role) | list | count > 0
- name: Unmap a client role from client service account
vars:
@ -140,4 +140,4 @@
that:
- result is changed
- result.end_state == []
- result.existing | selectattr("clientRole", "eq", true) | selectattr("name", "eq", "{{role}}") | list | count > 0
- result.existing | selectattr("clientRole", "eq", true) | selectattr("name", "eq", role) | list | count > 0