From 525ed41a0ad41888f7f795c71d4858f8da06f275 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sat, 15 Feb 2025 12:31:37 +0100 Subject: [PATCH] [PR #9727/910c57aa backport][stable-9] keycloak: repair integration tests by removing jinja2 templating from conditionals (#9726) (#9747) 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 910c57aaa00243eebd19fd265942dc322808f94b) Co-authored-by: Mark Armstrong --- .../keycloak_clientsecret_info/tasks/main.yml | 2 +- .../tasks/main.yml | 4 ++-- .../targets/keycloak_role/tasks/main.yml | 18 +++++++++--------- .../keycloak_user_federation/tasks/main.yml | 18 +++++++++--------- .../keycloak_user_rolemapping/tasks/main.yml | 10 +++++----- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/tests/integration/targets/keycloak_clientsecret_info/tasks/main.yml b/tests/integration/targets/keycloak_clientsecret_info/tasks/main.yml index a0cacf18895..2b51e630687 100644 --- a/tests/integration/targets/keycloak_clientsecret_info/tasks/main.yml +++ b/tests/integration/targets/keycloak_clientsecret_info/tasks/main.yml @@ -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) }}" diff --git a/tests/integration/targets/keycloak_clientsecret_regenerate/tasks/main.yml b/tests/integration/targets/keycloak_clientsecret_regenerate/tasks/main.yml index 9bd52698a21..56f864965d6 100644 --- a/tests/integration/targets/keycloak_clientsecret_regenerate/tasks/main.yml +++ b/tests/integration/targets/keycloak_clientsecret_regenerate/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/keycloak_role/tasks/main.yml b/tests/integration/targets/keycloak_role/tasks/main.yml index c649b868089..9111928a558 100644 --- a/tests/integration/targets/keycloak_role/tasks/main.yml +++ b/tests/integration/targets/keycloak_role/tasks/main.yml @@ -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 == {} \ No newline at end of file + - result.end_state == {} diff --git a/tests/integration/targets/keycloak_user_federation/tasks/main.yml b/tests/integration/targets/keycloak_user_federation/tasks/main.yml index ae0b4bf1622..d193a48f07a 100644 --- a/tests/integration/targets/keycloak_user_federation/tasks/main.yml +++ b/tests/integration/targets/keycloak_user_federation/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/keycloak_user_rolemapping/tasks/main.yml b/tests/integration/targets/keycloak_user_rolemapping/tasks/main.yml index 1a897ad9afd..464fab57866 100644 --- a/tests/integration/targets/keycloak_user_rolemapping/tasks/main.yml +++ b/tests/integration/targets/keycloak_user_rolemapping/tasks/main.yml @@ -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