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.
Comment #3 by code — 2015-08-23T23:44:38Z
The upload function didn't work at all. https://github.com/D-Programming-Language/phobos/pull/3576
Comment #4 by github-bugzilla — 2015-08-30T07:54:42Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/4a496c848c9ab5dff49ba4887900abd6acf7c160 fix Issue 14938 - std.net.curl tests should use localhost or stub any networking - implement test server on second thread that can be fed with premade responses and records the requests - rewrite tests - fix upload which didn't work at all https://github.com/D-Programming-Language/phobos/commit/ed97fd15faa69f02f33e74ed2213b53440516183 Merge pull request #3576 from MartinNowak/fix14938 fix Issue 14938 - std.net.curl tests should use localhost or stub any networking
Comment #5 by github-bugzilla — 2015-10-04T18:20:30Z
Commits pushed to stable at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/4a496c848c9ab5dff49ba4887900abd6acf7c160 fix Issue 14938 - std.net.curl tests should use localhost or stub any networking https://github.com/D-Programming-Language/phobos/commit/ed97fd15faa69f02f33e74ed2213b53440516183 Merge pull request #3576 from MartinNowak/fix14938