Skip to content
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

mock dns responses to make running tests easier and more efficient #383

Merged
merged 1 commit into from
May 18, 2022

Conversation

mikebonnet
Copy link
Contributor

By monkeypatching socket.getaddrinfo() in a couple of places, the requirement to add
entries to the hosts file (which usually requires root access) is removed. It also
avoid long timeouts in dual-stack IPv4/IPv6 environments where the tests try to connect
to the IPv6 address for localhost first, but the test service is only listening on the
IPv4 address.

Also update test_alternate_hosts() to wait for a successful connection, and fix a
logic error in StubStompServer where get_next_frame() was returning an empty string but the
caller was testing for None.

By monkeypatching socket.getaddrinfo() in a couple of places, the requirement to add
entries to the hosts file (which usually requires root access) is removed. It also
avoid long timeouts in dual-stack IPv4/IPv6 environments where the tests try to connect
to the IPv6 address for localhost first, but the test service is only listening on the
IPv4 address.

Also update test_alternate_hosts() to wait for a successful connection, and fix a
logic error in StubStompServer where get_next_frame() was returning an empty string but the
caller was testing for None.
@jasonrbriggs jasonrbriggs merged commit 2cb5d2e into jasonrbriggs:dev May 18, 2022
@jasonrbriggs
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants