From 5b4e9a9881da093e770300ac4d8315240c126eeb Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Thu, 11 Oct 2018 15:52:12 -0700 Subject: [PATCH] Change API to match cmdlet which is more reliable in AzDevOpsPipelines Windows (#8003) --- .../Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 index 2d9806de4a..8a5cda3e58 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 @@ -21,7 +21,7 @@ Describe "Test-Connection" -tags "CI" { $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 | + $realAddress = [System.Net.Dns]::GetHostEntry($hostName).AddressList | Where-Object {$_.AddressFamily -eq "InterNetwork"} | Select-Object -First 1 | Foreach-Object {$_.IPAddressToString} @@ -166,7 +166,7 @@ Describe "Test-Connection" -tags "CI" { It "ResolveDestination for address" { $result = Test-Connection $targetAddress -ResolveDestination -Count 1 - $resolvedName = [System.Net.DNS]::GetHostByName($targetName).HostName + $resolvedName = [System.Net.DNS]::GetHostEntry($targetAddress).HostName $result.Destination | Should -BeExactly $resolvedName $result.Replies[0].Address | Should -BeExactly $targetAddress