Guilherme Silberfarb Costa commited on
Commit
4970cc0
·
1 Parent(s): bc00a0d

Add portable smoke test diagnostics

Browse files
build/windows/smoke_test_portable.ps1 CHANGED
@@ -9,6 +9,7 @@ $appDirResolved = (Resolve-Path $AppDir).Path
9
  $configDir = Join-Path $appDirResolved "config"
10
  $runtimeDir = Join-Path $appDirResolved "runtime"
11
  $exePath = Join-Path $appDirResolved "MesaFrame.exe"
 
12
  $usersPath = Join-Path $configDir "smoke-users.json"
13
  $settingsPath = Join-Path $configDir "appsettings.json"
14
  $rootUrl = "http://127.0.0.1:$Port"
@@ -55,6 +56,13 @@ if (-not (Test-Path $exePath)) {
55
  throw "Executavel nao encontrado: $exePath"
56
  }
57
 
 
 
 
 
 
 
 
58
  $proc = Start-Process -FilePath $exePath -WorkingDirectory $appDirResolved -PassThru
59
 
60
  try {
@@ -103,9 +111,15 @@ try {
103
 
104
  $logradourosResp = Invoke-RestMethod -Uri $logradourosUrl -Headers @{ "X-Auth-Token" = $token } -TimeoutSec 10
105
  if (-not $logradourosResp.logradouros_eixos -or $logradourosResp.logradouros_eixos.Count -lt 1) {
 
 
106
  throw "Smoke test failed: /api/pesquisa/logradouros-eixos returned no suggestions."
107
  }
108
  }
 
 
 
 
109
  finally {
110
  if ($proc -and -not $proc.HasExited) {
111
  Stop-Process -Id $proc.Id -Force
 
9
  $configDir = Join-Path $appDirResolved "config"
10
  $runtimeDir = Join-Path $appDirResolved "runtime"
11
  $exePath = Join-Path $appDirResolved "MesaFrame.exe"
12
+ $startupLogPath = Join-Path $appDirResolved "MesaFrame-startup.log"
13
  $usersPath = Join-Path $configDir "smoke-users.json"
14
  $settingsPath = Join-Path $configDir "appsettings.json"
15
  $rootUrl = "http://127.0.0.1:$Port"
 
56
  throw "Executavel nao encontrado: $exePath"
57
  }
58
 
59
+ function Show-StartupDiagnostics {
60
+ if (Test-Path $startupLogPath) {
61
+ Write-Host "--- MesaFrame-startup.log ---"
62
+ Get-Content -Path $startupLogPath
63
+ }
64
+ }
65
+
66
  $proc = Start-Process -FilePath $exePath -WorkingDirectory $appDirResolved -PassThru
67
 
68
  try {
 
111
 
112
  $logradourosResp = Invoke-RestMethod -Uri $logradourosUrl -Headers @{ "X-Auth-Token" = $token } -TimeoutSec 10
113
  if (-not $logradourosResp.logradouros_eixos -or $logradourosResp.logradouros_eixos.Count -lt 1) {
114
+ Write-Host "--- /api/pesquisa/logradouros-eixos ---"
115
+ $logradourosResp | ConvertTo-Json -Depth 10 | Write-Host
116
  throw "Smoke test failed: /api/pesquisa/logradouros-eixos returned no suggestions."
117
  }
118
  }
119
+ catch {
120
+ Show-StartupDiagnostics
121
+ throw
122
+ }
123
  finally {
124
  if ($proc -and -not $proc.HasExited) {
125
  Stop-Process -Id $proc.Id -Force