Skip to content

Test-Connect/Ping Tests forcing IPv4 is unreliable - assumes GetHostEntry address list is in a specific order #7576

Closed

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.

Activity

  1. added
    Issue-Bug
    WG-Quality-Test
    on Aug 20, 2018
  2. vexx32 commented on Nov 18, 2019

    @vexx32
    Collaborator

    I think the changes in #10697 should cover the stated issues pretty well. The API surface has changed a bit since then as well, so if we find additional issues with either our tests or the cmdlet itself, we can go ahead and reopen / open a new issue as appropriate. 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugResolution-FixedWG-Quality-Test

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions