Add retry logic to prerequisite URL tests (#5601)
* Disable Requisiste URLs tests * Add retry for the URL tests
This commit is contained in:
parent
7da528c005
commit
926f148027
|
@ -15,10 +15,21 @@ Describe "Windows Installer" -Tags "Scenario" {
|
|||
(Get-Content $wixProductFile -Raw).Contains($preRequisitesLink) | Should Be $true
|
||||
}
|
||||
|
||||
It "Pre-Requisistes link for '<Name>' is reachable: <url>" -TestCases $linkCheckTestCases -Test {
|
||||
## Running 'Invoke-WebRequest' with WMF download URLs has been failing intermittently,
|
||||
## because sometimes the URLs lead to a 'this download is no longer available' page.
|
||||
## We use a retry logic here. Retry for 5 times with 1 second interval.
|
||||
It "Pre-Requisistes link for '<Name>' is reachable: <url>" -TestCases $linkCheckTestCases {
|
||||
param ($Url)
|
||||
|
||||
# Because an outdated link 'https://www.microsoft.com/download/details.aspx?id=504100000' would still return a 200 reponse (due to a redirection to an error page), it only checks that it returns something
|
||||
(Invoke-WebRequest $Url -UseBasicParsing) | Should Not Be $null
|
||||
foreach ($i in 1..5) {
|
||||
try {
|
||||
$result = Invoke-WebRequest $Url -UseBasicParsing
|
||||
break;
|
||||
} catch {
|
||||
Start-Sleep -Seconds 1
|
||||
}
|
||||
}
|
||||
|
||||
$result | Should Not Be $null
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue