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

IPv6 support #586

Open
netmilk opened this Issue Aug 2, 2016 · 4 comments

Comments

Projects
None yet
3 participants
@netmilk
Copy link
Contributor

netmilk commented Aug 2, 2016

Dredd is resolving hostnames always to the IPv4 address. When the backend is listening on IPv6 localhost ::1 and Dredd's server parameter is a hostname http://localhost:3000 the hostname is resolved to the IPv4 address 127.0.0.1 and all tests will fail with ECONNREFUSED:

error: Error connecting to server under test!

Some servers in some constellations are listening on the IPv6 only by default. The workaround solution is to force them to listen on the IPv4 localhost with some equivalent of:

rails server --binding=127.0.0.1
@philsturgeon

This comment has been minimized.

Copy link

philsturgeon commented Aug 2, 2016

🙌

@netmilk

This comment has been minimized.

Copy link
Contributor

netmilk commented Aug 4, 2016

The reasoning why this is happening: https://groups.google.com/forum/#!topic/nodejs/0W6UqKy_klk

@netmilk

This comment has been minimized.

Copy link
Contributor

netmilk commented Aug 4, 2016

I just realised this could be similar to this very old and closed issue: #126

@honzajavorek

This comment has been minimized.

Copy link
Member

honzajavorek commented Mar 13, 2017

Could we do some kind of fallbacking and try/catching?

  1. If Dredd gets a string localhost, it resolves it automatically to ::1 and tries to connect.
  2. If ::1 fails to connect, Dredd tries 127.0.0.1.
  3. If 127.0.0.1 fails to connect, then just pass localhost to the system and let it resolve ¯\_(ツ)_/¯

But that brings quite some overhead of reconnecting. This would have to happen just once, in the beginning, and then Dredd would need to respect the selected strategy for the rest of the requests.

Also, this could be an option:

  1. If localhost is given to Dredd, let the system to resolve it.
  2. If Dredd gets ECONNREFUSED, then try again with ::1 instead of localhost.

Again, Dredd would remember the selected strategy for all requests within the test run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment