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

Regression: localhost.localdomain default breaks name resolution #175

Open
dhay opened this issue Oct 24, 2023 · 3 comments
Open

Regression: localhost.localdomain default breaks name resolution #175

dhay opened this issue Oct 24, 2023 · 3 comments
Labels

Comments

@dhay
Copy link

dhay commented Oct 24, 2023

Describe the bug
In version 1.2.1, the following update was made:

Fix bug in :meth:pytest_flask.fixtures.live_server where SESSION_COOKIE_DOMAIN was set to false due to original_server_name defaulting to "localhost". The new default is "localhost.localdomain".

This causes issues when we go to make requests to our Flask test server. Specifically we get errors that look like this:

WARNING  urllib3.connectionpool:connectionpool.py:871 Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NameResolutionError("<urllib3.connection.HTTPConnection object at 0x16dd5a4d0>: Failed to resolve 'localhost.localdomain' ([Errno 8] nodename nor servname provided, or not known)")': /graphql

When we make a request to url_for, we get back a URL that looks like http://localhost.localdomain/graphql instead of http://localhost/graphql

While I know I can add localhost.localdomain to my local /etc/hosts file, there are many docker images we're using in our CI pipelines that also do not know how to resolve this domain name.

@dhay dhay added the bug label Oct 24, 2023
@vitalk
Copy link
Collaborator

vitalk commented Oct 29, 2023

Hello @dhay

The server_name is set to the default localhost.localdomain only when it's not explicitly specified. As a workaround I suggest to explicitly set server_name to the localhost in your test application config.

SERVER_NAME = 'localhost'

@dhay
Copy link
Author

dhay commented Oct 29, 2023

This is what I’ve done for the time being to work around the issue. That said, I’m not sure I understand the impetus for the change.

@guidoiaquinti
Copy link

guidoiaquinti commented Nov 15, 2023

Same issue here. Our test suite (involving the live_server fixture) works on 1.2.0 and breaks after it.

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

No branches or pull requests

3 participants