diff --git a/test/SmokeTests/OOProcSmokeTests/DotNetIsolated/run-smoke-tests.ps1 b/test/SmokeTests/OOProcSmokeTests/DotNetIsolated/run-smoke-tests.ps1 index adc367c9d..699f058ca 100644 --- a/test/SmokeTests/OOProcSmokeTests/DotNetIsolated/run-smoke-tests.ps1 +++ b/test/SmokeTests/OOProcSmokeTests/DotNetIsolated/run-smoke-tests.ps1 @@ -6,6 +6,10 @@ param( [string]$HttpStartPath ) +$retryCount = 0; +$statusUrl = $null; +$success = $false; + Do { $testIsRunning = $true; @@ -31,33 +35,32 @@ Do { Write-Host "Host is healthy!" -ForegroundColor Green # Note that any HTTP protocol errors (e.g. HTTP 4xx or 5xx) will cause an immediate failure - $startOrchestrationUri = "http://localhost:7071/$HttpStartPath" - Write-Host "Starting a new orchestration instance via POST to $startOrchestrationUri..." -ForegroundColor Yellow - - $result = Invoke-RestMethod -Method Post -Uri $startOrchestrationUri - Write-Host "Started orchestration with instance ID '$($result.id)'!" -ForegroundColor Yellow - Write-Host "Waiting for orchestration to complete..." -ForegroundColor Yellow - - $retryCount = 0 - $success = $false - $statusUrl = $result.statusQueryGetUri - - while ($retryCount -lt 65) { - $result = Invoke-RestMethod -Method Get -Uri $statusUrl - $runtimeStatus = $result.runtimeStatus - Write-Host "Orchestration is $runtimeStatus" -ForegroundColor Yellow - Write-Host $result - - if ($result.runtimeStatus -eq "Completed") { - $success = $true - $testIsRunning = $false - break - } - - Start-Sleep -Seconds 2 - $retryCount = $retryCount + 1 + if ($statusUrl -eq $null){ + $startOrchestrationUri = "http://localhost:7071/$HttpStartPath" + Write-Host "Starting a new orchestration instance via POST to $startOrchestrationUri..." -ForegroundColor Yellow + + $result = Invoke-RestMethod -Method Post -Uri $startOrchestrationUri + Write-Host "Started orchestration with instance ID '$($result.id)'!" -ForegroundColor Yellow + Write-Host "Waiting for orchestration to complete..." -ForegroundColor Yellow + + $statusUrl = $result.statusQueryGetUri + } + + + $result = Invoke-RestMethod -Method Get -Uri $statusUrl + $runtimeStatus = $result.runtimeStatus + Write-Host "Orchestration is $runtimeStatus" -ForegroundColor Yellow + Write-Host $result + + if ($result.runtimeStatus -eq "Completed") { + $success = $true + $testIsRunning = $false + break } + Start-Sleep -Seconds 2 + $retryCount = $retryCount + 1 + if ($success -eq $false) { throw "Orchestration didn't complete in time! :(" } @@ -76,7 +79,7 @@ Do { # This delay a bit excessive, but we want to make sure the Functions runtime is up and running before we start the orchestration # This number was determined, through trial and error, to be a safe amount of time to wait Start-Sleep -Seconds 40 -} while ($testIsRunning -eq $true) +} while (($testIsRunning -eq $true) -and ($retryCount -lt 65))