Skip to content

Test-Connection test setup fails on macOS due to DNS issue #12935

Closed

Description

@rjmholt

From the test output:

  Describing Test-Connection
    [-] Error occurred in Describe block 0ms
      ExtendedSocketException: nodename nor servname provided, or not known
      MethodInvocationException: Exception calling "GetHostEntry" with "1" argument(s): "nodename nor servname provided, or not known"
      at <ScriptBlock>, /Users/runner/runners/2.170.1/work/1/s/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1: line 15
      at Invoke-Blocks, /Users/runner/runners/2.170.1/work/1/a/bins/publish/Modules/Pester/4.10.1/Functions/SetupTeardown.ps1: line 135
      at Invoke-TestGroupSetupBlocks, /Users/runner/runners/2.170.1/work/1/a/bins/publish/Modules/Pester/4.10.1/Functions/SetupTeardown.ps1: line 121
      at DescribeImpl, /Users/runner/runners/2.170.1/work/1/a/bins/publish/Modules/Pester/4.10.1/Functions/Describe.ps1: line 209

Based on dotnet/runtime#29780 (comment), this seems to be a DNS resolution issue, and seems to be common on macOS.

I don't know enough about these tests or networking configuration to be a good judge of whether we should try to fix this or how, but want to discuss here if possible.

In particular:

  • Is this something we think we could fix or workaround in our code? The Test-Connection tests on macOS seem to have been flaky for some time.
  • Do we think there's some way we could improve the way the CI instance is configured to mitigate?
  • Otherwise, is there some other way we could perform test setup here that wouldn't hit this issue? Or possibly we could identify when we've hit this issue and handle it somehow?

/cc James Truher (@JamesWTruher) Steve Lee (@SteveL-MSFT) Ilya (@iSazonov)

Activity

  1. added
    Issue-Question
    on Jun 10, 2020
  2. vexx32 commented on Jun 10, 2020

    @vexx32
    Collaborator

    I don't have high hopes for this. There are tons of issues with the cmdlet on both MacOS and Linux, mainly because the basic .NET API for pings and just pretty much everything is... incomplete at best, and completely broken in some cases. (Try running a trace on Unix with the cmdlet; 99% of the data is unusable.) I filed an issue on the main ones that bothered me as I was (re)writing parts of the cmdlet last time around, and it's been largely ignored.

    At best, it looks like the .NET team don't have the more barebones networking APIs high on the priority list.

  3. added
    Issue-Code Cleanup
    Issue-Discussion
    and removed
    Issue-Question
    on Jun 10, 2020
  4. adityapatwardhan commented on Jun 10, 2020

    @adityapatwardhan
    Member

    I would consider marking the test as pending if it fails a lot.

  5. rjmholt commented on Jun 10, 2020

    @rjmholt
    CollaboratorAuthor

    Test is passing again for now. We have an issue at least now that we can refer back to. I'll close it for now, since it seems like there's not much we can do. But if repeated test failures prove to be a problem, we should consider making these tests -Pending

  6. TravisEz13 commented on Jun 10, 2020

    @TravisEz13
    Member

    some kind of DNS resolution problem.

    Is not very specific and $hostName = [System.Net.Dns]::GetHostName() should not really rely on a DNS server. I'm certain on my machine that it does not.

    I would consider marking the test as pending if it fails a lot.

    This is in a describe block, so pending the tests is not enough.

  7. rjmholt commented on Jun 10, 2020

    @rjmholt
    CollaboratorAuthor

    Is not very specific

    See:

    I don't know enough about these tests or networking configuration to be a good judge of whether we should try to fix this or how, but want to discuss here if possible.

    I invite further discussion by any who are more familiar with the functionality here

  8. iSazonov commented on Jun 11, 2020

    @iSazonov
    Collaborator

    We have a tracking issue here and in .Net Runtime repository. Can PowerShell team ping .Net team to fix the API? It is absolutely impossible to use the API on Unix-s for years. If they can not fix in .Net 5.0 maybe we switch to an alternative library to get Test-Connection working on Unix-s?

  9. rjmholt commented on Jun 11, 2020

    @rjmholt
    CollaboratorAuthor

    Looks like this is continuing to occur

  10. rjmholt commented on Jun 11, 2020

    @rjmholt
    CollaboratorAuthor

    Relevant code:

    $hostName = [System.Net.Dns]::GetHostName()
    $targetName = "localhost"
    $targetAddress = "127.0.0.1"
    $targetAddressIPv6 = "::1"
    $UnreachableAddress = "10.11.12.13"
    # this resolves to an actual IP rather than 127.0.0.1
    # this can also include both IPv4 and IPv6, so select InterNetwork rather than InterNetworkV6
    $realAddress = [System.Net.Dns]::GetHostEntry($hostName).AddressList |

  11. iSazonov commented on Jun 11, 2020

    @iSazonov
    Collaborator

    Maybe MacOS image was updated?

  12. 6 remaining items

  13. added
    Issue-Bug
    Waiting - DotNetCore
    WG-Maintainers-Build
    WG-Quality-Test
    and removed
    Issue-Discussion
    Waiting - DotNetCore
    on Jun 11, 2020
  14. rjmholt commented on Jun 12, 2020

    @rjmholt
    CollaboratorAuthor

    Testing in my PR indicates that nslookup also fails on macOS, meaning this issue is external to macOS

  15. rjmholt commented on Jun 12, 2020

    @rjmholt
    CollaboratorAuthor
  16. iSazonov commented on Jun 17, 2020

    @iSazonov
    Collaborator

    Will we track actions/runner-images#1042 here?

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-Maintainers-BuildWG-Quality-Test

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions