Fix unit tests on Win10 (attempt 2)

Thanks to @lifenjoiner for testing! Windows 10 behaves even more unexpectedly.
After it parses the "ip:port" string as a hostname, it attempts to upgrade from
http to https by appending `:443` and parsing that new URL again.
This seems to happen concurrently with the doomed DNS lookup and we see the
error from whichever fails first.
This commit is contained in:
William Elwood 2020-06-10 12:10:51 +01:00
parent 8c42c465b2
commit 92dda0d55a
1 changed files with 3 additions and 2 deletions

View File

@ -308,8 +308,9 @@ func prepSourceTestDownload(t *testing.T, d *SourceTestData, e *SourceTestExpect
case TestStateReadErr, TestStateReadSigErr:
e.err = "unexpected EOF"
case TestStateOpenErr, TestStateOpenSigErr:
path = "00000" + path // high numeric port is parsed but then fails to connect
e.err = "invalid port|no such host"
path = "00000" + path // high numeric port should be parsed but then fail to connect
// Win10 treats an invalid port as part of the hostname, then tries DNS lookup and magic http->https upgrades simultaneously
e.err = "invalid port|no such host|too many colons in address"
case TestStatePathErr:
path = "..." + path // non-numeric port fails URL parsing
}