Skip to content

Commit

Permalink
fix paths
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmrdavid committed Oct 1, 2024
1 parent 6315ac0 commit 9ef7e7a
Showing 1 changed file with 57 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# This is a simple smoke test runner to validate the .NET isolated smoke tests.
# It supercedes the usual e2e-tests.ps1 script for the .NET isolated scenario because building the tests on the docker image
# is unreliable. For more details, see: https://github.com/Azure/azure-functions-host/issues/7995
param(
[Parameter(Mandatory=$true)]
[string]$HttpStartPath
)

try {
# Make sure the Functions runtime is up and running
$pingUrl = "http://localhost:8080/admin/host/ping"
Write-Host "Pinging app at $pingUrl to ensure the host is healthy" -ForegroundColor Yellow
Invoke-RestMethod -Method Post -Uri "http://localhost:8080/admin/host/ping"
Write-Host "Host is healthy!" -ForegroundColor Green
Exit-OnError

if ($NoValidation -eq $false) {
# Note that any HTTP protocol errors (e.g. HTTP 4xx or 5xx) will cause an immediate failure
$startOrchestrationUri = "http://localhost:8080/$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 15) {
$result = Invoke-RestMethod -Method Get -Uri $statusUrl
$runtimeStatus = $result.runtimeStatus
Write-Host "Orchestration is $runtimeStatus" -ForegroundColor Yellow

if ($result.runtimeStatus -eq "Completed") {
$success = $true
Write-Host $result
break
}

Start-Sleep -Seconds 1
$retryCount = $retryCount + 1
}
}

if ($success -eq $false) {
throw "Orchestration didn't complete in time! :("
}
} catch {
Write-Host "An error occurred:" -ForegroundColor Red
Write-Host $_ -ForegroundColor Red

# Rethrow the original exception
throw
}

Write-Host "Success!" -ForegroundColor Green

0 comments on commit 9ef7e7a

Please sign in to comment.