-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6315ac0
commit 9ef7e7a
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
test/SmokeTests/OOProcSmokeTests/DotNetIsolated/run-smoke-tests.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |