diff options
Diffstat (limited to 'scripts/Verify-PublishedHttp.ps1')
| -rw-r--r-- | scripts/Verify-PublishedHttp.ps1 | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/scripts/Verify-PublishedHttp.ps1 b/scripts/Verify-PublishedHttp.ps1 index a02a28b..7dd5fe2 100644 --- a/scripts/Verify-PublishedHttp.ps1 +++ b/scripts/Verify-PublishedHttp.ps1 @@ -29,6 +29,8 @@ $runRoot = Join-Path $testRootPath ('agent-mcp-http-cmd-' + [Guid]::NewGuid().To $runRootForward = $runRoot.Replace('\', '/') $endpoint = 'http://127.0.0.1:8080/mcp' $log = Join-Path $evidence 'verification.log' +$serverOut = Join-Path $evidence 'server.stdout.log' +$serverErr = Join-Path $evidence 'server.stderr.log' $server = $null New-Item -ItemType Directory -Force -Path $evidence | Out-Null New-Item -ItemType Directory -Path $runRoot | Out-Null @@ -47,14 +49,17 @@ run-probe.cmdは次を順番に実行し、どれかが失敗したら非0で終 "@ try { - & $agent check --config $config --lang ja 2>&1 | Tee-Object -FilePath $log - if ($LASTEXITCODE -ne 0) { throw "Published check failed with exit code $LASTEXITCODE." } + & $agent show $config 2>&1 | Tee-Object -FilePath $log + if ($LASTEXITCODE -ne 0) { throw "Published configuration show failed with exit code $LASTEXITCODE." } - $server = Start-Process -FilePath $agent -ArgumentList @('serve','--config',$config,'--lang','ja','--transport','http') ` - -WorkingDirectory $bundle -WindowStyle Hidden -PassThru + $server = Start-Process -FilePath $agent -ArgumentList @($config) -WorkingDirectory $bundle ` + -WindowStyle Hidden -RedirectStandardOutput $serverOut -RedirectStandardError $serverErr -PassThru $ready = $false for ($attempt = 0; $attempt -lt 100; $attempt++) { - if ($server.HasExited) { throw "Published server exited before readiness: $($server.ExitCode)" } + if ($server.HasExited) { + $diagnostic = if (Test-Path -LiteralPath $serverErr) { Get-Content -LiteralPath $serverErr -Raw } else { '' } + throw "Published server exited before readiness: $($server.ExitCode) $diagnostic" + } try { $response = Invoke-WebRequest -Uri $endpoint -Method Get -SkipHttpErrorCheck if ($response.StatusCode -eq 405) { $ready = $true; break } |
