-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fb keycloak client improvement #9644
Fb keycloak client improvement #9644
Conversation
TASK [keycloak_client : Assert changes not detected in last two tasks (desire when same, and check)] *** task path: /root/ansible_collections/community/general/tests/output/.tmp/integration/keycloak_client-p3ttqf7d-ÅÑŚÌβŁÈ/tests/integration/targets/keycloak_client/tasks/main.yml:79 fatal: [testhost]: FAILED! => { "assertion": "check_client_when_present_and_same is not changed", "changed": false, "evaluated_to": false, "msg": "Assertion failed" }
431a6c5
to
0a088f8
Compare
0a088f8
to
8495695
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @amPrimeSign thanks for your contribution
I have a couple of suggestions on it, and I think the test file actually needs fixing.
Co-authored-by: Alexei Znamensky <[email protected]>
Co-authored-by: Alexei Znamensky <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @amPrimeSign thanks for the adjustments.
The changelog might use a bit of a tweak, and I left another comment with a suggestion that you may disregard at will.
changelogs/fragments/9644-kc_client-test-improvement-and-fix.yaml
Outdated
Show resolved
Hide resolved
if 'config' in mapper: | ||
for key, value in mapper['config'].items(): | ||
if isinstance(value, bool): | ||
mapper['config'][key] = str(value).lower() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be overthinking this, but you are modifying items of a dict that you are iterating over. I remember this causing problems in some versions of Python back in the day. But assuming that the tests cover this part of the code, it should be alright.
Also, an alternative way that would not incur in the non-existent problem 😆 (feel free to disregard) to implement this could be:
if 'config' in mapper: | |
for key, value in mapper['config'].items(): | |
if isinstance(value, bool): | |
mapper['config'][key] = str(value).lower() | |
if 'config' in mapper: | |
bool_items = {k: str(v).lower() for k,v in mapper['config'].items() if isinstance(v, bool)} | |
mapper['config'].update(bool_items) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think editing an existing value should be ok, but I'm not a Python expert. For me, both options are fine, please pick your preferred one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifying dict values is fine, deleting or adding items would cause issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for chipping in @apollo13 !
@amPrimeSign so there you go, we're good the way it is now. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@russoz Thanks :)
Co-authored-by: Alexei Znamensky <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Backport to stable-9: 💚 backport PR created✅ Backport PR branch: Backported as #9670 🤖 @patchback |
* Fix for failed test TASK [keycloak_client : Assert changes not detected in last two tasks (desire when same, and check)] *** task path: /root/ansible_collections/community/general/tests/output/.tmp/integration/keycloak_client-p3ttqf7d-ÅÑŚÌβŁÈ/tests/integration/targets/keycloak_client/tasks/main.yml:79 fatal: [testhost]: FAILED! => { "assertion": "check_client_when_present_and_same is not changed", "changed": false, "evaluated_to": false, "msg": "Assertion failed" } * Improved test data to test more scenarios, e.g documentation uses True in examples * Normalize values in config * add changelog * Apply suggestions from code review Co-authored-by: Alexei Znamensky <[email protected]> * Update tests/integration/targets/keycloak_client/vars/main.yml Co-authored-by: Alexei Znamensky <[email protected]> * Update changelogs/fragments/9644-kc_client-test-improvement-and-fix.yaml Co-authored-by: Alexei Znamensky <[email protected]> --------- Co-authored-by: Alexei Znamensky <[email protected]> (cherry picked from commit 250dc11)
Backport to stable-10: 💚 backport PR created✅ Backport PR branch: Backported as #9671 🤖 @patchback |
@amPrimeSign thanks for your contribution! |
* Fix for failed test TASK [keycloak_client : Assert changes not detected in last two tasks (desire when same, and check)] *** task path: /root/ansible_collections/community/general/tests/output/.tmp/integration/keycloak_client-p3ttqf7d-ÅÑŚÌβŁÈ/tests/integration/targets/keycloak_client/tasks/main.yml:79 fatal: [testhost]: FAILED! => { "assertion": "check_client_when_present_and_same is not changed", "changed": false, "evaluated_to": false, "msg": "Assertion failed" } * Improved test data to test more scenarios, e.g documentation uses True in examples * Normalize values in config * add changelog * Apply suggestions from code review Co-authored-by: Alexei Znamensky <[email protected]> * Update tests/integration/targets/keycloak_client/vars/main.yml Co-authored-by: Alexei Znamensky <[email protected]> * Update changelogs/fragments/9644-kc_client-test-improvement-and-fix.yaml Co-authored-by: Alexei Znamensky <[email protected]> --------- Co-authored-by: Alexei Znamensky <[email protected]> (cherry picked from commit 250dc11)
…#9670) Fb keycloak client improvement (#9644) * Fix for failed test TASK [keycloak_client : Assert changes not detected in last two tasks (desire when same, and check)] *** task path: /root/ansible_collections/community/general/tests/output/.tmp/integration/keycloak_client-p3ttqf7d-ÅÑŚÌβŁÈ/tests/integration/targets/keycloak_client/tasks/main.yml:79 fatal: [testhost]: FAILED! => { "assertion": "check_client_when_present_and_same is not changed", "changed": false, "evaluated_to": false, "msg": "Assertion failed" } * Improved test data to test more scenarios, e.g documentation uses True in examples * Normalize values in config * add changelog * Apply suggestions from code review Co-authored-by: Alexei Znamensky <[email protected]> * Update tests/integration/targets/keycloak_client/vars/main.yml Co-authored-by: Alexei Znamensky <[email protected]> * Update changelogs/fragments/9644-kc_client-test-improvement-and-fix.yaml Co-authored-by: Alexei Znamensky <[email protected]> --------- Co-authored-by: Alexei Znamensky <[email protected]> (cherry picked from commit 250dc11) Co-authored-by: amPrimeSign <[email protected]>
#9671) Fb keycloak client improvement (#9644) * Fix for failed test TASK [keycloak_client : Assert changes not detected in last two tasks (desire when same, and check)] *** task path: /root/ansible_collections/community/general/tests/output/.tmp/integration/keycloak_client-p3ttqf7d-ÅÑŚÌβŁÈ/tests/integration/targets/keycloak_client/tasks/main.yml:79 fatal: [testhost]: FAILED! => { "assertion": "check_client_when_present_and_same is not changed", "changed": false, "evaluated_to": false, "msg": "Assertion failed" } * Improved test data to test more scenarios, e.g documentation uses True in examples * Normalize values in config * add changelog * Apply suggestions from code review Co-authored-by: Alexei Znamensky <[email protected]> * Update tests/integration/targets/keycloak_client/vars/main.yml Co-authored-by: Alexei Znamensky <[email protected]> * Update changelogs/fragments/9644-kc_client-test-improvement-and-fix.yaml Co-authored-by: Alexei Znamensky <[email protected]> --------- Co-authored-by: Alexei Znamensky <[email protected]> (cherry picked from commit 250dc11) Co-authored-by: amPrimeSign <[email protected]>
@russoz, @felixfontein thanks for the feedback and for the quick processing |
* Fix for failed test TASK [keycloak_client : Assert changes not detected in last two tasks (desire when same, and check)] *** task path: /root/ansible_collections/community/general/tests/output/.tmp/integration/keycloak_client-p3ttqf7d-ÅÑŚÌβŁÈ/tests/integration/targets/keycloak_client/tasks/main.yml:79 fatal: [testhost]: FAILED! => { "assertion": "check_client_when_present_and_same is not changed", "changed": false, "evaluated_to": false, "msg": "Assertion failed" } * Improved test data to test more scenarios, e.g documentation uses True in examples * Normalize values in config * add changelog * Apply suggestions from code review Co-authored-by: Alexei Znamensky <[email protected]> * Update tests/integration/targets/keycloak_client/vars/main.yml Co-authored-by: Alexei Znamensky <[email protected]> * Update changelogs/fragments/9644-kc_client-test-improvement-and-fix.yaml Co-authored-by: Alexei Znamensky <[email protected]> --------- Co-authored-by: Alexei Znamensky <[email protected]>
SUMMARY
Fix and improve existing tests for
keycloak_client
moduleISSUE TYPE
COMPONENT NAME
keycloak_client
ADDITIONAL INFORMATION
Run
ansible-test integration -v keycloak_client --allow-unsupported --docker fedora40 --docker-network host
Before:
After: