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

Skip test if no ipv6 on system detected #1383

Merged
merged 1 commit into from
Feb 24, 2022

Conversation

euri10
Copy link
Member

@euri10 euri10 commented Feb 16, 2022

Fixes #1281

@euri10
Copy link
Member Author

euri10 commented Feb 16, 2022

ok with this fix, the ipv6 test is skipped as expected when disabling ipv6 with the following:

 sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
 sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1

however a side effect is that since /etc/hosts contains ::1 localhost ip6-localhost ip6-loopback then test called hostname fails, it cannot create the server on

uvicorn/uvicorn/server.py

Lines 148 to 156 in 632f33e

server = await loop.create_server(
create_protocol,
host=config.host,
port=config.port,
ssl=config.ssl,
backlog=config.backlog,
)
except OSError as exc:
logger.error(exc)
because it resolves localhost to ::1

Care to test this @kloczek because I dont know if this will behave the same on a machine that has no ipv6 by default like the one you seem to have for running your test suite

@euri10
Copy link
Member Author

euri10 commented Feb 23, 2022

checked in a fedora docker that has no ipv6 enabled and that looks fine, no ipv6 entries in /etc/hosts

Copy link
Member

@aminalaee aminalaee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@euri10 euri10 merged commit 8585051 into encode:master Feb 24, 2022
Kludex pushed a commit to sephioh/uvicorn that referenced this pull request Oct 29, 2022
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.

0.15.0: pytest is failing in tests/test_main.py::test_run[ipv6] on system without ipv6
2 participants