param( [string] $BaseUrl = "http://localhost:5000", [string] $SimProfile = "sm" ) $ErrorActionPreference = "Stop" $repoRoot = Resolve-Path "$PSScriptRoot/../.." Push-Location $repoRoot $job = $null try { Write-Host "Building sim service and smoke harness..." dotnet build ops/crypto/sim-crypto-service/SimCryptoService.csproj -c Release | Out-Host dotnet build ops/crypto/sim-crypto-smoke/SimCryptoSmoke.csproj -c Release | Out-Host Write-Host "Starting sim service at $BaseUrl ..." $job = Start-Job -ArgumentList $repoRoot, $BaseUrl -ScriptBlock { param($path, $url) Set-Location $path $env:ASPNETCORE_URLS = $url dotnet run --project ops/crypto/sim-crypto-service/SimCryptoService.csproj --no-build -c Release } Start-Sleep -Seconds 6 $env:STELLAOPS_CRYPTO_SIM_URL = $BaseUrl $env:SIM_PROFILE = $SimProfile Write-Host "Running smoke harness (profile=$SimProfile, url=$BaseUrl)..." dotnet run --project ops/crypto/sim-crypto-smoke/SimCryptoSmoke.csproj --no-build -c Release $exitCode = $LASTEXITCODE if ($exitCode -ne 0) { throw "Smoke harness failed with exit code $exitCode" } } finally { if ($job) { Stop-Job $job -ErrorAction SilentlyContinue | Out-Null Receive-Job $job -ErrorAction SilentlyContinue | Out-Null Remove-Job $job -ErrorAction SilentlyContinue | Out-Null } Pop-Location }