Files
inquiry_robot/deploy/_remote_final_smoke.ps1
T

20 lines
1.5 KiB
PowerShell

$ErrorActionPreference = "Continue"
Select-String -Path "E:\wwwroot\inquiry-new\logs\stdout.log" -Pattern "redis_mode=" | Select-Object -Last 2 | ForEach-Object { Write-Host $_.Line }
$bodyPath = Join-Path $env:TEMP "login-body.json"
Set-Content -Path $bodyPath -Value '{"username":"admin","password":"123456","captcha":"","checkKey":""}' -Encoding ASCII
$login = Invoke-RestMethod -Uri "http://127.0.0.1:8180/jeecgboot/sys/login" -Method POST -InFile $bodyPath -ContentType "application/json;charset=UTF-8"
$h = @{ "X-Access-Token" = $login.result.token }
$a = Invoke-RestMethod -Uri "http://127.0.0.1:8180/jeecgboot/inquiry/quoteTemplate/agent/listEnabled" -Headers $h
Write-Host ("agent_enabled=" + @($a.result).Count + " login_captcha_ok=" + $login.success)
# agent process?
$agent = Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -and ($_.CommandLine -like '*inquiry-agent*' -or $_.CommandLine -like '*uvicorn*' -or $_.CommandLine -like '*8910*') } | Select-Object -First 5
if ($agent) { $agent | ForEach-Object { Write-Host ("proc pid=" + $_.ProcessId + " " + $_.CommandLine.Substring(0,[Math]::Min(120,$_.CommandLine.Length))) } }
else { Write-Host "agent_proc_not_found_in_wmi_sample" }
# health if any
foreach ($u in @("http://127.0.0.1:8910/health","http://127.0.0.1:8810/health","http://127.0.0.1:8910/")) {
try {
$r = Invoke-WebRequest -Uri $u -UseBasicParsing -TimeoutSec 3
Write-Host ("health " + $u + " " + $r.StatusCode)
} catch { Write-Host ("health " + $u + " fail") }
}
Write-Host "FINAL_SMOKE_DONE"