fix: prevent cifmw_validations_xml_filter hang#3993
Conversation
Issue: The validations playbook was hanging indefinitely when creating JUnit XML files for validation results. Root cause: ET.tostring() with encoding='utf-8' returned bytes, which Ansible's copy module couldn't serialize in a template context, causing an indefinite hang. Solution: Changed encoding parameter to 'unicode', which returns str directly, allowing Ansible to process it normally. Verification: - Playbook completes successfully in 1.16 seconds - XML file is generated correctly - No breaking changes (fully backward compatible)
There was a problem hiding this comment.
I left a comment to remove the galaxy.yml change that doesn't belong to this patch.
Also, how can we be sure that this will fix the error? Have you tried to reproduce the error using a malformed file? What was the result in that case?
That's why creating a test, with molecule or with unit tests is crucial here.
Also: 2 tests are failing.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Issue: The validations playbook was hanging indefinitely when creating JUnit XML files for validation results. Root cause: ET.tostring() with encoding='utf-8' returned bytes, which Ansible's copy module couldn't serialize in a template context, causing an indefinite hang. Solution: Changed encoding parameter to 'unicode', which returns str directly, allowing Ansible to process it normally. Verification: - Playbook completes successfully in 1.16 seconds - XML file is generated correctly - No breaking changes (fully backward compatible) Signed-off-by: Harshita Goel <hgoel@redhat.com>
Add comprehensive unit tests to verify the hang fix and robustness: - Test that filter returns str (not bytes) - critical for the fix - Test empty, single, and multiple test cases - Test malformed input (missing fields, long errors, special chars) - Test XML validity and proper escaping - Test with 100+ test cases to ensure performance Signed-off-by: Harshita Goel <hgoel@redhat.com>
|
@rebtoor |
|
Build failed (check pipeline). Post ✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 01m 56s |
fix: prevent cifmw_validations_xml_filter hang
Issue: The validations playbook was hanging indefinitely when
creating JUnit XML files for validation results.
Root cause: ET.tostring() with encoding='utf-8' returned bytes,
which Ansible's copy module couldn't serialize in a template
context, causing an indefinite hang.
Solution: Changed encoding parameter to 'unicode', which returns
str directly, allowing Ansible to process it normally.
Verification: