Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove jinja2 templating from conditionals in keycloak integration tests (#9726) #9727

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

armkeh
Copy link
Contributor

@armkeh armkeh commented Feb 11, 2025

SUMMARY

Fix warnings and failures in keycloak module integration tests caused by use of jinja2 templating in conditionals.

Fixes #9726.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

keycloak_role

ADDITIONAL INFORMATION

To run the test, first start Keycloak:

docker run --rm --name mykeycloak -p 8080:8080 -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=password quay.io/keycloak/keycloak:latest start-dev --http-relative-path /auth

Then run one of the affected integration tests, e.g.,

ansible-test integration keycloak_role --allow-unsupported -vvv

Sample of existing test behaviour (in this case, causing a failure in the keycloak_role module tests):

# ...
TASK [keycloak_role : Assert client role created] ******************************
task path: /home/armkeh/projects/ansible_collections/community/general/tests/output/.tmp/integration/keycloak_role-752i69kl-ÅÑŚÌβŁÈ/tests/integration/targets/keycloak_role/tasks/main.yml:154
[WARNING]: conditional statements should not include jinja2 templating
delimiters such as {{ }} or {% %}. Found: result.end_state.name == "{{ role }}"
[WARNING]: conditional statements should not include jinja2 templating
delimiters such as {{ }} or {% %}. Found: result.end_state.containerId == "{{
client.end_state.id }}"
fatal: [testhost]: FAILED! => {
    "msg": "The conditional check 'result.end_state.containerId == \"{{ client.end_state.id }}\"' failed. The error was: Conditional is marked as unsafe, and cannot be evaluated."
}

PLAY RECAP *********************************************************************
testhost                   : ok=20   changed=6    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0  
# ...

@armkeh
Copy link
Contributor Author

armkeh commented Feb 11, 2025

Marked as draft for the moment while I check if other modules have the same problem. From my previous checks, I don't think any other module's tests are failing due to this, but I didn't check for warnings yet.

@ansibullbot ansibullbot added WIP Work in progress bug This issue/PR relates to a bug integration tests/integration tests tests labels Feb 11, 2025
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-8 Automatically create a backport for the stable-8 branch backport-9 Automatically create a backport for the stable-9 branch backport-10 Automatically create a backport for the stable-10 branch labels Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8 Automatically create a backport for the stable-8 branch backport-9 Automatically create a backport for the stable-9 branch backport-10 Automatically create a backport for the stable-10 branch bug This issue/PR relates to a bug check-before-release PR will be looked at again shortly before release and merged if possible. integration tests/integration tests tests WIP Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

keycloak: fix tests which include jinja2 templating in conditional
3 participants