Hello Gophers,

I'm running unit test in my local windows machine (Windows 11 Pro) and I 
get a test failure for TestLookupLocalPtr using my locally compiled Go 1.25 

here is the test command that I run
PS C:\Users\grand\projects\go\src\net> ../../bin/go test -v ./...

=== RUN   TestLookupLocalPTR
    lookup_windows_test.go:174: different results 192.168.1.56: 
exp:["host.docker.internal."] 
got:["gateway.docker.internal.","host.docker.internal."]

Upon checking the unit test, it looks like it's testing whether *LookupAddr* 
and *lookupPTR* retuns the same result

I believe *LookupAddr* is getting the DNSs by calling Windows API and 
looking at the  *C:\Windows\System32\drivers\etc\hosts *

my hosts file indeed has 2 entries for the IP:

# Added by Docker Desktop
192.168.1.56 host.docker.internal
192.168.1.56 gateway.docker.internal

while *lookupPTR* implementation seems to rely on the output from ping
essentially it's this ping command *ping -n -1 -a <addr>* and doing a regex 
matching `(?m)^Pinging\s+([a-zA-Z0-9.\-]+)\s+\[.*$`

I tested the ping command in my windows

(base) C:\Users\grand>ping -n 1 -a 192.168.1.56

Pinging host.docker.internal [192.168.1.56] with 32 bytes of data:
Reply from 192.168.1.56: bytes=32 time<1ms TTL=128

Ping statistics for 192.168.1.56:
    Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

And it only produces 1 result

I was about to open an issue in Github, however, I have limited background 
knowledge for this and I would like some inputs whether this is an issue in 
the unit test or is an issue in the implementation of some of the functions

Let me know should you require more info

Thank you for your inputs!

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/03735176-21e0-4f3d-bb40-cfd48e2e22e9n%40googlegroups.com.

Reply via email to