Xenial unable to resolve `localhost.` as a valid FQDN

Travis Xenial with sudo: required is unable to resolve localhost. as a name.
This is causing failures on tests for urllib3/urllib3 while we’re trying to add testing for Python 3.8.

import socket
conn = socket.create_connection(("localhost.", 80))  # Results in a socket.gaierror() when a server is running.

See: https://travis-ci.org/urllib3/urllib3/jobs/455782940 where all 3 tests that are failing attempt to connect to localhost.. All tests pass on Trusty, macOS, and Windows.

I tested this, but localhost. doesn’t seem to work on Trusty on GCE, either. https://travis-ci.org/BanzaiMan/travis_production_test/jobs/457076700#L471

Seeing that your other jobs are running with sudo: false, I am inclined to think that this is a difference in network configuration between AWS and GCP.

Making localhost. work may go beyond our capability (and ask Google to change something). Can your jobs work with localhost instead?

So all our localhost connections work, thing is we’re trying to specifically test the resolution of localhost. and it’s effects on the resulting request (Setting the Host header to localhost, TLS, etc). I suppose we can skip these tests on GCE for now as they’re tested elsewhere. Thanks for the investigative work!

1 Like