Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Warn when a repo is unreachable, don't produce a confusing error #352

Merged
merged 11 commits into from
Nov 2, 2018
Prev Previous commit
Next Next commit
don't use resolve-location in tests to check reachability
  • Loading branch information
edyoung committed Oct 30, 2018
commit 3a8a53a98d6c743ecff6490a016eb66083c71ff6
13 changes: 11 additions & 2 deletions Tests/PSGetTestUtils.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,18 @@ function GetAndSet-PSGetTestGalleryDetails
{
$SourceUri = 'http://localhost:8765/api/v2/'
$psgetModule = Import-Module -Name PowerShellGet -PassThru -Scope Local
$ResolvedLocalSource = & $psgetModule Resolve-Location -Location $SourceUri -LocationParameterName 'SourceLocation'

if($ResolvedLocalSource -and
# see if the localhost repo used in CI is present
$pingSuccess = $false
try
{
Invoke-WebRequest -Uri $SourceUri
$pingSuccess = $true
} catch {

}

if($pingSuccess -and
$PSVersionTable.PSVersion -ge '5.0.0' -and
[System.Environment]::OSVersion.Version -ge "6.2.9200.0" -and
$PSCulture -eq 'en-US')
Expand Down