v
v copied to clipboard
vlib: fix tcp_test.v
The listen_tcp method should not accept .unix address family.
Test that it indeed fails when invoked.
Also, remove the flaky flag on tcp_test.v as none of the tests here has any real reason to be flaky.
Tested on Linux 6.6 (amd64) and FreeBSD 13.2 (amd64).
Panics on Windows... maybe part of why it was marked flaky...
0.0.0.0:45123: net: op timed out; code: 9
Why is it trying to dial to an ipv4 address when an ipv6 address is given? Seems like a bug in the address resolve code to me
0.0.0.0:45123: net: op timed out; code: 9
Why is it trying to dial to an ipv4 address when an ipv6 address is given? Seems like a bug in the address resolve code to me
I found some funky looking code in tcp.c.v that I removed. It was responsible for replacing ::: with localhost which resolved to an IP4 address. Having a generic resolve which magically figures out the address family is probably not very safe, but yet common. I've ran into a similar issue with Node.js too.
OK. That leads into a rabbit hole. What does not work on Windows is to open a connection to 0.0.0.0. That is only a valid IP address to bind to for accept. If we know for sure that the server is listening on all devices on a specific port, then we know for sure that it is listening on 127.0.0.1 (within reason). The fix should be to not use ${server.addr} but 127.0.0.1 in the fetch in server_test.v:
The failing Docker tests were really good! It showed me that the tcp_test.v IPv6 tests actually uses IPv6 now. ;-)
(The reason why I did not catch it myself first, was because I have a habit of using --network=host and there I have IPv6.)
I want to disable to IPv6 tests on environments where there is known not to exist IPv6 stack, or validate that the test fails. Any ideas on how to do that? I know this PR is getting out of hand but first I will fix it then I will chop it up into reasonable commit.
This also seems related with this: https://github.com/vlang/v/issues/20441