Skip to content

Commit

Permalink
some refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmrdavid committed Oct 1, 2024
1 parent a919eca commit 28793b4
Showing 1 changed file with 29 additions and 26 deletions.
55 changes: 29 additions & 26 deletions test/SmokeTests/OOProcSmokeTests/DotNetIsolated/run-smoke-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ param(
[string]$HttpStartPath
)

$retryCount = 0;
$statusUrl = $null;
$success = $false;

Do {
$testIsRunning = $true;

Expand All @@ -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! :("
}
Expand All @@ -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))



Expand Down

0 comments on commit 28793b4

Please sign in to comment.