Record Windows gates and partial native child-work checks
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
--- original
|
||||
+++ private
|
||||
@@ -1,9 +1,9 @@
|
||||
#requires -Version 7.0
|
||||
param([Parameter(Mandatory=$true)][string]$ServerExe)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
-$taskRoot = (Resolve-Path (Join-Path $PSScriptRoot '../../..')).Path
|
||||
+$taskRoot = $PSScriptRoot
|
||||
$exe = (Resolve-Path -LiteralPath $ServerExe).Path
|
||||
-$runRoot = Join-Path $taskRoot ('.local/rest-coverage-' + (Get-Date -Format 'yyyyMMdd-HHmmss'))
|
||||
+$runRoot = Join-Path $taskRoot 'rest'
|
||||
$storePath = Join-Path $runRoot 'store'
|
||||
New-Item -ItemType Directory -Path $runRoot,$storePath | Out-Null
|
||||
$payload = Get-Content -LiteralPath (Join-Path $PSScriptRoot 'coverage-probe.json') -Raw | ConvertFrom-Json -AsHashtable
|
||||
@@ -23,6 +23,7 @@
|
||||
function Start-ProbeServer {
|
||||
$script:launch++
|
||||
$startOptions = @{
|
||||
+ WorkingDirectory = Join-Path $PSScriptRoot 'unrelated-cwd'
|
||||
FilePath = $exe
|
||||
ArgumentList = @('--bind',"127.0.0.1:$probePort",'--data-dir',('"'+$storePath+'"'),'--token-file',('"'+$tokenPath+'"'))
|
||||
PassThru = $true
|
||||
@@ -32,6 +33,7 @@
|
||||
# WindowStyle is Windows-only; Unix keeps the child attached to this probe.
|
||||
if ($IsWindows) { $startOptions.WindowStyle = 'Hidden' }
|
||||
$script:probeProcess = Start-Process @startOptions
|
||||
+ @{pid=$script:probeProcess.Id;exe=$exe;arguments=$startOptions.ArgumentList;cwd=$startOptions.WorkingDirectory;PATH=$env:PATH;started=(Get-Date -Format o)} | ConvertTo-Json -Depth 10 | Set-Content (Join-Path $runRoot "server-$script:launch.launch.json")
|
||||
for ($attempt = 0; $attempt -lt 40; $attempt++) {
|
||||
if ($script:probeProcess.HasExited) { throw 'Probe server exited before readiness' }
|
||||
try { $ready=Invoke-WebRequest "$base/health/ready" -TimeoutSec 1; if ($ready.StatusCode -eq 200) { return } } catch {}
|
||||
@@ -44,6 +46,7 @@
|
||||
Stop-Process -InputObject $script:probeProcess
|
||||
$script:probeProcess.WaitForExit()
|
||||
}
|
||||
+ if ($null -ne $script:probeProcess) { @{pid=$script:probeProcess.Id;has_exited=$script:probeProcess.HasExited;exit_code=$script:probeProcess.ExitCode;stopped=(Get-Date -Format o);method='owned probe Stop-Process after assertions'} | ConvertTo-Json | Set-Content (Join-Path $runRoot "server-$script:launch.stop.json") }
|
||||
$script:probeProcess = $null
|
||||
}
|
||||
function Call-Probe([string]$name,[string]$method,[string]$path,$body=$null,[string]$etag='',[int]$expectedStatus=200) {
|
||||
Reference in New Issue
Block a user