-
Notifications
You must be signed in to change notification settings - Fork 240
test/system: Fix issue with python resolver IP type #1598
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
Conversation
debarshiray
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.
Thanks for looking into this @pennbauman ! It took me while to figure out what's going on - clearly I don't know Python or networking at all. :D
Let me see if I got it right.
You are beginning to accumulate some non-trivial commits in the project. You should consider adding yourself to the copyright notices of the files you have touched.
| import socket; \ | ||
| import sys; \ | ||
| family = socket.AddressFamily.AF_INET if sys.argv[1] == "A" else 0; \ | ||
| family = socket.AddressFamily.AF_INET6 if sys.argv[1] == "AAAA" else 0; \ |
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.
Aha, family was getting overwritten to 0 in the second line if sys.argv[1] is "A", right?
test/system/203-network.bats
Outdated
| family = socket.AddressFamily.AF_INET if sys.argv[1] == "A" else 0; \ | ||
| family = socket.AddressFamily.AF_INET6 if sys.argv[1] == "AAAA" else 0; \ | ||
| addr = socket.getaddrinfo(sys.argv[2], None, family, socket.SocketKind.SOCK_RAW)[0][4][0]; \ | ||
| family = {"A": socket.AddressFamily.AF_INET, "AAAA": socket.AddressFamily.AF_INET6} |
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.
Are we missing a trailing semi-colon?
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.
It looks like the tests don't fail without the trailing semi-colon. Maybe they are getting skipped internally and not getting reflected as a failure?
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 restored the semi-colon for the time being. The tests pass. Please let me know if I got that wrong.
0fd5be4 to
37ebc6d
Compare
The existing code was overwriting the address family from socket.AddressFamily.AF_INET to 0, when an IPv4 address was requested by setting sys.argv[1] to 'A'. Fallout from 5bac0ba containers#1598 Signed-off-by: Penn Bauman <me@pennbauman.com>
The existing code was overwriting the address family from socket.AddressFamily.AF_INET to 0, when an IPv4 address was requested by setting sys.argv[1] to 'A'. Fallout from 5bac0ba containers#1598 Signed-off-by: Penn Bauman <me@pennbauman.com>
37ebc6d to
e13a58c
Compare
|
Build succeeded. ✔️ unit-test SUCCESS in 2m 09s |
|
Thanks again, @pennbauman ! |
The existing code would never properly select the IPv4 address instead a fallback value was selected when the IPv4 option was used, the script is updated to that both IPv4 and IPv6 will be properly selected.