Bug 14938 – std.net.curl tests should use localhost or stub any networking
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-08-20T00:11:00Z
Last change time
2015-10-04T18:20:30Z
Keywords
pull
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2015-08-20T00:11:31Z
Test coverage for std.net.curl is pretty bad b/c the network tests aren't run regularly. The main reason is that they actually request remote hosts (there is even a test app running on d-lang.appspot.com).
It would be much better to either stub curl for the unittests or at least use a localhost server (could be a simply as a TCP listener logging the requests for and fed with responses by the test).
Comment #1 by dlang-bugzilla — 2015-08-20T01:55:59Z
This applies to std.socket as well.
Comment #2 by code — 2015-08-20T11:01:06Z
Though std.socket mostly does DNS resolution. Maybe use HOSTALIASES on non-Windows systems.
It doesn't make much sense to test the actual DNS resolution anyhow, as the purpose is to test the correct usage of gethostbyname et. al.