Fix socket specs when network not available #12961
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Socket specs were failing when running on a system with no network.
UDP multicast specs are already pretty fragile and handle many points of failure as acceptable because the host system/network might not support UDP multicast. This patch just adds code for another failure type.
Then there are a couple of specs which initiate a DNS lookup to a non-existent domain (
doesnotexist.example.org.
). When no DNS server is available,getaddrinfo
apparently returnsEAI_AGAIN
to try again later (which of course won't help anything when there's simply no network to reach an upstream DNS server).I'm not entirely sure if simply accepting
EAI_AGAIN
is the best way to fix this. The spec could also be marked as pending in that case. But I think success is fine.Also, I'm wondering if
EAI_AGAIN
should be handled somewhere inAddrinfo
, retrying and finally raise a more specific error.But that's a whole different story. For now I think these changes should be good to make the spec suite work on isolated machines (a use case for that is the build environment on build.opensuse.org/).
If you want to run specs without network access, I found the easiest way is a docker container with
--network none
.