-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
The two tests that verify Test-Connection with IPv4 implicit/explicit options assume that GetHostEntry() returns the AddressList with the IPv4 address as the first entry.
I'm seeing, on Ubuntu 18.04, that the order is reversed, the IPv6 address is reported first.
The test should be updated by searching the IPHostEntry.AddressList for the entry with AddressFamily -eq InterNetwork.
The failure also occurs on Cent0S 7
Actually, this test has a number of issues:
1: It assumes the address list returned by GetHostEntry and GetHostAddresses have a predictable order.
This means that $var->AddressList[0] is not consistent across OS installations and is not guaranteed to be consistent across runs; at least the API doesn't indicate such.
Likely the best solution for this is to query both API's in BeforeAll, build a lookup table and chagne the Should statements to verify the IP address(es) Test-Connection reports are in the the associated table.
2: It assumes that localhost has an IPV6 address (::1).
Ubuntu 18.04, not domain joined, does not.
The test 'Force IPv6' should be skipped for this case. Querying in BeforeAll and checking the IP address list is sufficient.
3: It assumes that GetHostByName('localhost') returns the FQDN name.
On the same, clean Ubuntu 18.04 system, the return value is 'localhost'
The test 'ResolveDestination for address' is a NOP for this case.
4: $targetName is used as the starting name in a number of tests; it is localhost
This is a minor note but it makes the tests that reference it misleading. Using 'localhost' directly would clarify this.