-
Notifications
You must be signed in to change notification settings - Fork 2.9k
test/system: Fix the IPv6 address mismatch error #27623
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -449,3 +449,11 @@ function default_addr() { | |
| local expr='[.[0].addr_info[] | select(.deprecated != true)][0].local' | ||
| ip -j -"${ip_ver}" addr show "${ifname}" | jq -rM "${expr}" | ||
| } | ||
|
|
||
| function all_addr() { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just realised that there's now a The original functions I introduced for that purpose were
Having a function that returns all host-side addresses and checking that the first global unicast one assigned in the container fixes the issue that, given host (initial namespace) IPv6 addresses h1, h2, h3, reported in that order, and container addresses c1 (matching h3), c2 (matching h2) , c3 (matching h1), we'll actually find that c1 matches h3 and make the test pass. But it doesn't fix the fact that, for example, if we have host address h1, and container addresses c1 (not matching any host address) and c2 (matching h1), the test should pass as pasta copied all the addresses from the host (that's the expectation). However, it will fail, because we fetch only the first address in the container. So, ideally, we should check that all the host addresses are reflected in the container, to match what pasta currently does and what Podman expects (and might actually strictly need, at some point). If that's too complicated or beyond the scope of this fix, we could at least make this slightly more future-proof and keep duplication to a minimum by:
...then, once somebody has time to implement the proper test, there could be another function iterating on the addresses found on the host and making sure that each one of them are present on the container (it's trivial if addresses are sorted). |
||
| local ip_ver="${1}" | ||
| local ifname="${2:-$(default_ifname "${ip_ver}")}" | ||
|
|
||
| local expr='[.[0].addr_info[] | select(.deprecated != true)]' | ||
| ip -j -"${ip_ver}" addr show "${ifname}" | jq -rM "${expr}" | grep local | cut -d'"' -f4 | tr '\n' ' ' | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why all this grep, cur, tr thing? If we only want the local addresses we can just add them to the jq filter. which seems to return the same result unless I am missing something
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that would return the same result. I will update in next push. |
||
| } | ||
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.
can't you just use
assert "${host_addresses}" =~ "${container_address}"?Right this the assert for exit code is unnecessary as the command run with set -e meaining if the grep fails it exits right away without reaching the exit code check anyway.
And then then generally leads to a poor error message compared to our assert helper.
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 the review. Will update.