-
Notifications
You must be signed in to change notification settings - Fork 14
Mix of test framework fixes and improvements #1166
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Author
|
We got a "cut off" job here due to duplicate build, but the Qemu test results are here https://github.com/kernelkit/infix/actions/runs/18068123992 |
wkz
requested changes
Sep 28, 2025
Contributor
wkz
left a comment
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.
We don't necessarily get rid of test.fail() now. It was just something that struck me as I read the log message.
Signed-off-by: Joachim Wiberg <[email protected]>
A very common pattern in our tests is:
if (condition):
print(f"the condition failed with {output}")
test.fail()
This change allows us to write:
if (condition):
test.fail(f"the condition failed with {output}")
Signed-off-by: Joachim Wiberg <[email protected]>
Before this change: ok 2 - Configure basic end-device firewall not ok 3 - Verify unused interface assigned to default zone # Exiting (2025-09-25 11:33:00) # Traceback (most recent call last): # File "/home/jocke/src/x-misc/test/./case/infix_firewall/basic/test.py", line 127, in <module> # assert unused_if not in public_zone["interface"], \ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # AssertionError: Unused interface e4 should be in default zone 'public', got interfaces: ['e2', 'e3', 'e5', 'e7', 'e8'] After this change: ok 2 - Configure basic end-device firewall not ok 3 - Verify unused interface assigned to default zone # Exiting (2025-09-25 11:35:00) # File "/home/jocke/src/x-misc/test/./case/infix_firewall/basic/test.py", line 127, in <module> # assert unused_if not in public_zone["interface"], \ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # Unused interface e4 should be in default zone 'public', got interfaces: ['e2', 'e3', 'e5', 'e7', 'e8'] Slightly shorter and arguably easier to read for a non-pythonic human. Signed-off-by: Joachim Wiberg <[email protected]>
The xpath_to_uri() method only processed the first predicate in XPath
expressions with multiple [key='value'] patterns. Each re.sub() call
was performed on the original xpath instead of the result the previous
substitutions, causing subsequent predicates to be ignored.
Example XPath that would fail:
/infix-firewall:firewall/zone[name='untrusted']/interface[.='e2']
Would incorrectly convert to:
/infix-firewall:firewall/zone[name='untrusted']/interface=e2
Instead of the correct RESTCONF URL:
/infix-firewall:firewall/zone=untrusted/interface=e2
Signed-off-by: Joachim Wiberg <[email protected]>
wkz
approved these changes
Sep 29, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
A mix of test framework fixes and improvements extracted from the firewall branch for separate review.
Checklist
Tick relevant boxes, this PR is-a or has-a: